Skip to content

Let's use AI to Earn!

feat: add endpoints to retrieve entities by ID in material and media … (#389)

nevin36be7f70c919
diff --git a/project/backend/apps/aitoearn-server/src/content/material.controller.ts b/project/backend/apps/aitoearn-server/src/content/material.controller.ts
index e72db1a3..84a76e27 100644
--- a/project/backend/apps/aitoearn-server/src/content/material.controller.ts
+++ b/project/backend/apps/aitoearn-server/src/content/material.controller.ts
@@ -181,6 +181,16 @@ export class MaterialController {
return res
}
+ @ApiDoc({
+ summary: 'Get Draft by ID',
+ description: 'Get a draft by its identifier.',
+ })
+ @Get('info/:id')
+ async getInfo(@Param('id') id: string) {
+ const res = await this.materialService.getInfo(id)
+ return res
+ }
+
@ApiDoc({
summary: 'List Drafts',
description: 'Retrieve a paginated list of drafts with optional filters.',
diff --git a/project/backend/apps/aitoearn-server/src/content/materialGroup.controller.ts b/project/backend/apps/aitoearn-server/src/content/materialGroup.controller.ts
index d1cba0a6..9531da78 100644
--- a/project/backend/apps/aitoearn-server/src/content/materialGroup.controller.ts
+++ b/project/backend/apps/aitoearn-server/src/content/materialGroup.controller.ts
@@ -85,6 +85,16 @@ export class MaterialGroupController {
return res
}
+ @ApiDoc({
+ summary: 'Get Material Group by ID',
+ description: 'Get a material group by its identifier.',
+ })
+ @Get('info/:id')
+ async getGroupInfo(@Param('id') id: string) {
+ const res = await this.materialGroupService.getGroupInfo(id)
+ return res
+ }
+
@ApiDoc({
summary: 'List Material Groups',
description: 'Retrieve a paginated list of material groups.',
diff --git a/project/backend/apps/aitoearn-server/src/content/media.controller.ts b/project/backend/apps/aitoearn-server/src/content/media.controller.ts
index 64ffd747..171a47f5 100644
--- a/project/backend/apps/aitoearn-server/src/content/media.controller.ts
+++ b/project/backend/apps/aitoearn-server/src/content/media.controller.ts
@@ -86,6 +86,16 @@ export class MediaController {
return res
}
+ @ApiDoc({
+ summary: 'Get Media by ID',
+ description: 'Get a media asset by its identifier.',
+ })
+ @Get('info/:id')
+ async getInfo(@Param('id') id: string) {
+ const res = await this.mediaService.getInfo(id)
+ return res
+ }
+
@Get('list/:pageNo/:pageSize')
@ApiDoc({
summary: 'List Media Assets',
diff --git a/project/backend/apps/aitoearn-server/src/content/mediaGroup.controller.ts b/project/backend/apps/aitoearn-server/src/content/mediaGroup.controller.ts
index 3f621841..89114627 100644
--- a/project/backend/apps/aitoearn-server/src/content/mediaGroup.controller.ts
+++ b/project/backend/apps/aitoearn-server/src/content/mediaGroup.controller.ts
@@ -91,6 +91,16 @@ export class MediaGroupController {
return res
}
+ @ApiDoc({
+ summary: 'Get Media Group by ID',
+ description: 'Get a media group by its identifier.',
+ })
+ @Get('info/:id')
+ async getGroupInfo(@Param('id') id: string) {
+ const res = await this.mediaGroupService.getInfo(id)
+ return res
+ }
+
/**
* 获取资源组的简略图列表
* @param userId