shared/api/endpoints/resource/
curation.rs

1//! routes for the resource curation by admin
2
3use crate::{
4    api::Method,
5    domain::{
6        resource::curation::{
7            CommentId, ResourceCurationCommentCreatePath, ResourceCurationCommentGetPath,
8            ResourceCurationCommentRequest, ResourceCurationCommentResponse, ResourceCurationData,
9            ResourceCurationPath, ResourceCurationUpdatePath, ResourceCurationUpdateRequest,
10        },
11        CreateResponse,
12    },
13    error::EmptyError,
14};
15
16use super::ApiEndpoint;
17/// Get a curation data by Resource ID.
18pub struct GetCuration;
19impl ApiEndpoint for GetCuration {
20    type Path = ResourceCurationPath;
21    type Req = ();
22    type Res = ResourceCurationData;
23    type Err = EmptyError;
24    const METHOD: Method = Method::Get;
25}
26
27/// Update a curation data by Resource ID.
28pub struct UpdateCuration;
29impl ApiEndpoint for UpdateCuration {
30    type Path = ResourceCurationUpdatePath;
31    type Req = ResourceCurationUpdateRequest;
32    type Res = ();
33    type Err = EmptyError;
34    const METHOD: Method = Method::Patch;
35}
36
37/// Submit a comment by Resource ID.
38pub struct CreateComment;
39impl ApiEndpoint for CreateComment {
40    type Path = ResourceCurationCommentCreatePath;
41    type Req = ResourceCurationCommentRequest;
42    type Res = CreateResponse<CommentId>;
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 Path = ResourceCurationCommentGetPath;
51    type Req = ();
52    type Res = ResourceCurationCommentResponse;
53    type Err = EmptyError;
54    const METHOD: Method = Method::Get;
55}