Skip to content

Commit

Permalink
[FEATURE] add samples in result of GET /vr-resource
Browse files Browse the repository at this point in the history
  • Loading branch information
woog2roid committed Apr 20, 2024
1 parent 2ac693e commit 209e470
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/domain/sample/sample.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ import { RequestInfoRepository } from './repository/request-info.repository';
SampleVrResourceRepository,
RequestInfoRepository,
],
exports: [SampleVrResourceService],
})
export class SampleModule {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty, PickType } from '@nestjs/swagger';
import { VrResource } from '../../entity/vr-resource.entity';
import { SampleVrResourceDto } from 'src/domain/sample/dto/response/sample-get-vr-resources.response.dto';

export class VrResourceDto extends PickType(VrResource, [
'id',
Expand Down Expand Up @@ -34,7 +35,17 @@ export class GetVrResourcesResponseDto {
})
vrResources: VrResourceDto[];

constructor(vrResources: VrResourceDto[]) {
@ApiProperty({
description: '샘플 VR자원 목록',
type: [SampleVrResourceDto],
})
sampleVrResources: SampleVrResourceDto[];

constructor(
vrResources: VrResourceDto[],
sampleVrResources: SampleVrResourceDto[],
) {
this.vrResources = vrResources;
this.sampleVrResources = sampleVrResources;
}
}
8 changes: 6 additions & 2 deletions src/domain/vr-resource/vr-resource.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import { GetAiTaskQueueResponseDto } from './dto/response/get-ai-task-queue.resp
import { VrResourceService } from './service/vr-resource.service';
import { GetVrResourcesResponseDto } from './dto/response/get-vr-resources.response.dto';
import { GenerateAvatarRequestDto } from './dto/request/generate-avatar.request.dto';
import { SampleVrResourceService } from '../sample/service/sample-vr-resource.service';

@ApiTags('VR-resource')
@Controller('vr-resource')
export class VrResourceController {
constructor(
private readonly vrResourceQueueService: VrResourceQueueService,
private readonly vrResourceService: VrResourceService,
private readonly sampleVrResourceService: SampleVrResourceService,
) {}

@ApiOperation({
Expand Down Expand Up @@ -88,7 +90,7 @@ export class VrResourceController {
}

@ApiOperation({
summary: '완성된 VR 자원(배경, 아바타) 불러오기',
summary: '완성된 VR 자원 불러오기 (샘플 포함)',
})
@ApiBearerAuth()
@ApiResponse({ type: GetVrResourcesResponseDto })
Expand All @@ -98,7 +100,9 @@ export class VrResourceController {
@AuthUser() user: User,
): Promise<GetVrResourcesResponseDto> {
const vrResourceDtos = await this.vrResourceService.getVrResources(user);
return new GetVrResourcesResponseDto(vrResourceDtos);
const sampleVrResourceDtos =
await this.sampleVrResourceService.getVrResources();
return new GetVrResourcesResponseDto(vrResourceDtos, sampleVrResourceDtos);
}

@ApiOperation({
Expand Down
7 changes: 6 additions & 1 deletion src/domain/vr-resource/vr-resource.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ import { VrResourceService } from './service/vr-resource.service';
import { VrResourceRepository } from './repository/vr-resource.repository';
import { VrResource } from './entity/vr-resource.entity';
import { RequestInfoRepository } from '../sample/repository/request-info.repository';
import { SampleModule } from '../sample/sample.module';

@Module({
imports: [TypeOrmModule.forFeature([Group, User, VrResource]), GcpModule],
imports: [
TypeOrmModule.forFeature([Group, User, VrResource]),
GcpModule,
SampleModule,
],
controllers: [VrResourceController],
providers: [
VrResourceQueueService,
Expand Down

0 comments on commit 209e470

Please sign in to comment.