-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit e8a3c9c Author: Jonas Simoen <[email protected]> Date: Mon May 20 16:54:42 2024 +0200 feat(news): article management
- Loading branch information
1 parent
6dd6d1d
commit dc51cdc
Showing
5 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,41 @@ | ||
import { FastifyPluginAsync } from "fastify"; | ||
import { GetArticleHandler, GetArticlesHandler } from "../controllers/News"; | ||
import { GetArticleHandler, GetArticlesHandler, PostArticleHandler, PutArticleHandler } from "../controllers/News"; | ||
import { PostArticleSchema, PutArticleSchema } from "../types/body-schema"; | ||
|
||
export const PublicNewsRouter: FastifyPluginAsync = async server => { | ||
server.route({ | ||
method: 'GET', | ||
url: '', | ||
handler: GetArticlesHandler, | ||
schema: { | ||
querystring: { | ||
page: { type: 'number' } | ||
} | ||
method: 'GET', | ||
url: '', | ||
handler: GetArticlesHandler, | ||
schema: { | ||
querystring: { | ||
page: { type: 'number' } | ||
} | ||
} | ||
}); | ||
|
||
server.route({ | ||
method: 'GET', | ||
url: '/:slug', | ||
handler: GetArticleHandler | ||
method: 'GET', | ||
url: '/:slug', | ||
handler: GetArticleHandler | ||
}); | ||
} | ||
|
||
export const AdminNewsRouter: FastifyPluginAsync = async server => { | ||
server.route({ | ||
method: 'POST', | ||
url: '', | ||
handler: PostArticleHandler, | ||
schema: { | ||
body: PostArticleSchema, | ||
} | ||
}); | ||
server.route({ | ||
method: 'PUT', | ||
url: '/:id', | ||
handler: PutArticleHandler, | ||
schema: { | ||
body: PutArticleSchema, | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters