Skip to content

Commit 4ca4eea

Browse files
committed
feat: impelement inserting userId to news annotation map table on /news/annotate api
1 parent 03ad5a6 commit 4ca4eea

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/api/routes/newsRoute.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ const newsRoute: RouteType = (apiRouter) => {
104104
);
105105

106106
try {
107-
const {body} = req;
107+
const {body, decodedAccessToken} = req;
108+
const {uid: userId} = decodedAccessToken;
108109

109-
const result = await newsService.annotateNews(uniqueRequestId, body);
110+
const result = await newsService.annotateNews(
111+
uniqueRequestId,
112+
userId,
113+
body
114+
);
110115

111116
logger.debug(
112117
uniqueRequestId,

src/services/NewsService.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default class NewsService {
4848

4949
public async annotateNews(
5050
uniqueRequestId: NullableString,
51+
userId: string,
5152
annotationInputDTO: iNewsAnnotationsInputDTO
5253
): Promise<iGenericServiceResult<null>> {
5354
return db.tx("annotate-news", async (transaction) => {
@@ -87,7 +88,7 @@ export default class NewsService {
8788
newsId,
8889
annotationId,
8990
annotatedBy: "USER",
90-
userId: null, // FIXME: Add userId from request
91+
userId,
9192
};
9293
});
9394

0 commit comments

Comments
 (0)