File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type {
1212 GetAllTagsParams ,
1313 GetQuestionByTagIdParams ,
1414 GetTopInteractedTagsParams ,
15+ GetTagByIdParams ,
1516} from "./shared.types" ;
1617
1718export async function getAllTags ( params : GetAllTagsParams ) {
@@ -64,6 +65,23 @@ export async function getAllTags(params: GetAllTagsParams) {
6465 }
6566}
6667
68+ export async function getTagById ( params : GetTagByIdParams ) {
69+ try {
70+ connectToDatabase ( ) ;
71+
72+ const { tagId } = params ;
73+
74+ const tag = await Tag . findOne ( {
75+ _id : tagId ,
76+ } ) ;
77+
78+ return tag ;
79+ } catch ( error ) {
80+ console . log ( error ) ;
81+ throw error ;
82+ }
83+ }
84+
6785export async function getQuestionsByTagId ( params : GetQuestionByTagIdParams ) {
6886 try {
6987 connectToDatabase ( ) ;
You can’t perform that action at this time.
0 commit comments