Skip to content

Commit

Permalink
feat: get all submitted manga submission
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Oct 17, 2024
1 parent cfaeb43 commit 67137ae
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/modules/story-event/story-event.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ export class StoryEventController {
return this.storyEventSvc.getSubmittedCharacter();
}

@Get('submission/manga/submitted')
@UseGuards(AuthGuard, RolesGuard)
@ApiBearerAuth()
@UseInterceptors(AuthUserInterceptor)
@SetRequestTimeout()
@Roles(Role.Admin)
getPendingManga() {
return this.storyEventSvc.getSubmittedManga();
}

@Post('submission/character/approve')
@UseGuards(AuthGuard, RolesGuard)
@ApiBearerAuth()
Expand Down
23 changes: 20 additions & 3 deletions src/modules/story-event/story-event.graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ export class StoryEventGraphql {
{}
);
}
async getSubmittedManga(token: string) {
return this.graphqlSvc.query(
this.configSvc.get<string>('graphql.endpoint'),
token,
`query story_event_submission {
story_event_submission(where: {type: {_eq: "manga"}, status: {_eq: "Submitted"}}) {
id
name
status
created_at
data
}
}`,
'story_character',
{}
);
}

async updateStoryArtwork(variables: any) {
const headers = {
Expand Down Expand Up @@ -617,7 +634,7 @@ export class StoryEventGraphql {
this.configSvc.get<string>('graphql.endpoint'),
'',
`query availableCharacter($user_id: bpchar) {
default: story_character(where: {is_default_character: {_eq: true}}) {
default: story_character(where: {is_default_character: {_eq: true}, status: {_eq: "Approved"}}) {
id
avatar_url
descripton_url
Expand All @@ -633,7 +650,7 @@ export class StoryEventGraphql {
ip_asset_id
}
}
collected: story_character(where: {user_collect_characters: {user_id: {_eq: $user_id}}}) {
collected: story_character(where: {user_collect_characters: {user_id: {_eq: $user_id}}, , status: {_eq: "Approved"}}) {
id
avatar_url
descripton_url
Expand All @@ -649,7 +666,7 @@ export class StoryEventGraphql {
ip_asset_id
}
}
user_ip: story_character(where: {user_id: {_eq: $user_id}}) {
user_ip: story_character(where: {user_id: {_eq: $user_id}, status: {_eq: "Approved"}}) {
id
avatar_url
descripton_url
Expand Down
5 changes: 5 additions & 0 deletions src/modules/story-event/story-event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ export class StoryEventService {
}
}

async getSubmittedManga() {
const { token } = ContextProvider.getAuthUser();
return this.storyEventGraphql.getSubmittedManga(token);
}

async submitArtwork(
data: SubmitArtworkRequestDto,
files: Array<Express.Multer.File>
Expand Down

0 comments on commit 67137ae

Please sign in to comment.