generated from samchon/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBbsArticlesController.ts
28 lines (25 loc) · 979 Bytes
/
BbsArticlesController.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import typia from "typia";
import { BbsArticleProvider } from "../providers/BbsArticleProvider";
import { IBbsArticle } from "../api/structures/IBbsArticle";
import { AuthorizedCrudController } from "./crud/AuthorizedCrudController";
export class BbsArticlesController extends AuthorizedCrudController<
null,
IBbsArticle,
IBbsArticle.IStore,
IBbsArticle.IUpdate
>({
path: "bbs/articles",
authorize: async () => null,
read: (_actor: null, id: string) => BbsArticleProvider.at(id),
create: {
assert: typia.createAssert<IBbsArticle.IStore>(),
execute: (_actor: null, input: IBbsArticle.IStore) =>
BbsArticleProvider.store(input),
},
update: {
assert: typia.createAssert<IBbsArticle.IUpdate>(),
execute: (_actor: null, id: string, input: IBbsArticle.IUpdate) =>
BbsArticleProvider.update(id, input),
},
erase: (_actor: null, id: string) => BbsArticleProvider.erase(id),
}) {}