shared/api/endpoints/jig/
curation.rs

1//! routes for the jig curation by admin
2
3use crate::{
4    api::Method,
5    domain::{
6        jig::curation::{
7            CommentId, JigCurationCommentCreatePath, JigCurationCommentGetPath,
8            JigCurationCommentRequest, JigCurationCommentResponse, JigCurationData,
9            JigCurationPath, JigCurationUpdatePath, JigCurationUpdateRequest,
10        },
11        CreateResponse,
12    },
13    error::EmptyError,
14};
15
16use super::ApiEndpoint;
17/// Get a curation data by JIG ID.
18pub struct GetCuration;
19impl ApiEndpoint for GetCuration {
20    type Req = ();
21    type Res = JigCurationData;
22    type Path = JigCurationPath;
23    type Err = EmptyError;
24    const METHOD: Method = Method::Get;
25}
26
27/// Update a curation data by JIG ID.
28pub struct UpdateCuration;
29impl ApiEndpoint for UpdateCuration {
30    type Req = JigCurationUpdateRequest;
31    type Res = ();
32    type Path = JigCurationUpdatePath;
33    type Err = EmptyError;
34    const METHOD: Method = Method::Patch;
35}
36
37/// Submit a comment by JIG ID.
38pub struct CreateComment;
39impl ApiEndpoint for CreateComment {
40    type Req = JigCurationCommentRequest;
41    type Res = CreateResponse<CommentId>;
42    type Path = JigCurationCommentCreatePath;
43    type Err = EmptyError;
44    const METHOD: Method = Method::Post;
45}
46
47/// Get a comment by comment ID.
48pub struct GetComment;
49impl ApiEndpoint for GetComment {
50    type Req = ();
51    type Res = JigCurationCommentResponse;
52    type Path = JigCurationCommentGetPath;
53    type Err = EmptyError;
54    const METHOD: Method = Method::Get;
55}