From 57c8b054c2550571dafdbf1ed4e54a2f120d7be8 Mon Sep 17 00:00:00 2001 From: Yam Borodetsky Date: Fri, 21 Mar 2025 19:43:21 +0500 Subject: [PATCH] feat: Add token authentication to article, profile, and user endpoints - Implemented token authentication for create, update, delete, and fetch operations in articles, profiles, and users. - Updated API documentation to reflect the new security requirements for these endpoints. --- src/app.module.ts | 5 ----- src/articles/articles.plugin.ts | 20 ++++++++++++++++++++ src/profiles/profiles.plugin.ts | 15 +++++++++++++++ src/users/users.plugin.ts | 10 ++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/app.module.ts b/src/app.module.ts index 298c4547..42e51ca5 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -47,11 +47,6 @@ export const setupApp = () => { }, }, }, - security: [ - { - tokenAuth: [], - }, - ], }, exclude: ['/'], swaggerOptions: { diff --git a/src/articles/articles.plugin.ts b/src/articles/articles.plugin.ts index a990a1b7..e93f873a 100644 --- a/src/articles/articles.plugin.ts +++ b/src/articles/articles.plugin.ts @@ -49,6 +49,11 @@ export const articlesPlugin = new Elysia().use(setupArticles).group( response: ReturnedArticleResponseSchema, detail: { summary: 'Create Article', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -68,6 +73,11 @@ export const articlesPlugin = new Elysia().use(setupArticles).group( response: ReturnedArticleListSchema, detail: { summary: 'Artifle Feed', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -96,6 +106,11 @@ export const articlesPlugin = new Elysia().use(setupArticles).group( response: ReturnedArticleResponseSchema, detail: { summary: 'Update Article', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -111,6 +126,11 @@ export const articlesPlugin = new Elysia().use(setupArticles).group( response: DeleteArticleResponse, detail: { summary: 'Delete Article', + security: [ + { + tokenAuth: [], + }, + ], }, }, ), diff --git a/src/profiles/profiles.plugin.ts b/src/profiles/profiles.plugin.ts index d08c128f..43231393 100644 --- a/src/profiles/profiles.plugin.ts +++ b/src/profiles/profiles.plugin.ts @@ -23,6 +23,11 @@ export const profilesPlugin = new Elysia().use(setupProfiles).group( response: ReturnedProfileSchema, detail: { summary: 'Profile', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -38,6 +43,11 @@ export const profilesPlugin = new Elysia().use(setupProfiles).group( response: ReturnedProfileSchema, detail: { summary: 'Follow Profile', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -54,6 +64,11 @@ export const profilesPlugin = new Elysia().use(setupProfiles).group( response: ReturnedProfileSchema, detail: { summary: 'Unfollow Profile', + security: [ + { + tokenAuth: [], + }, + ], }, }, ), diff --git a/src/users/users.plugin.ts b/src/users/users.plugin.ts index 77d4453d..f0a296d1 100644 --- a/src/users/users.plugin.ts +++ b/src/users/users.plugin.ts @@ -55,6 +55,11 @@ export const usersPlugin = new Elysia() response: ReturnedUserSchema, detail: { summary: 'Current User', + security: [ + { + tokenAuth: [], + }, + ], }, }, ) @@ -71,6 +76,11 @@ export const usersPlugin = new Elysia() response: ReturnedUserSchema, detail: { summary: 'Update User', + security: [ + { + tokenAuth: [], + }, + ], }, }, ),