This commit is contained in:
@@ -110,6 +110,24 @@ export class CreateLauncherBuildJobDto {
|
||||
downloadUrl?: string;
|
||||
}
|
||||
|
||||
export class ListLauncherBuildJobsQuery {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
target?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
page?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
limit?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
since?: string;
|
||||
}
|
||||
|
||||
|
||||
export class CreateLauncherAppLinkDto {
|
||||
@IsUUID()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query } from '@nestjs/common';
|
||||
|
||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherCommonSettingDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherCommonSettingDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto } from './dto';
|
||||
import { CreateLauncherAppLinkDto, CreateLauncherBuildJobDto, CreateLauncherCommonSettingDto, CreateLauncherVersionDto, UpdateLauncherSourceDto, LinkLauncherVersionSourceDto, MoveLauncherAppLinkDto, UpdateLauncherAppLinkDto, UpdateLauncherBuildEnvDto, UpdateLauncherCommonSettingDto, UpdateLauncherUserAppPermissionsDto, DeployLauncherBackendDto, ListLauncherBuildJobsQuery } from './dto';
|
||||
import { LauncherService } from './launcher.service';
|
||||
|
||||
@Controller('launcher')
|
||||
@@ -49,8 +49,8 @@ export class LauncherController {
|
||||
}
|
||||
|
||||
@Get('builds')
|
||||
listBuildJobs() {
|
||||
return this.launcherService.listBuildJobs();
|
||||
listBuildJobs(@Query() query: ListLauncherBuildJobsQuery) {
|
||||
return this.launcherService.listBuildJobs(query);
|
||||
}
|
||||
|
||||
@Post('builds')
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
CreateLauncherCommonSettingDto,
|
||||
CreateLauncherVersionDto,
|
||||
DeployLauncherBackendDto,
|
||||
ListLauncherBuildJobsQuery,
|
||||
UpdateLauncherSourceDto,
|
||||
LinkLauncherVersionSourceDto,
|
||||
UpdateLauncherAppLinkDto,
|
||||
@@ -426,10 +427,19 @@ export class LauncherService {
|
||||
};
|
||||
}
|
||||
|
||||
listBuildJobs() {
|
||||
listBuildJobs(query: ListLauncherBuildJobsQuery = {}) {
|
||||
const page = toPositiveInt(query.page, 1);
|
||||
const limit = Math.min(toPositiveInt(query.limit, 30), 100);
|
||||
const since = query.since ? new Date(query.since) : null;
|
||||
|
||||
return this.prisma.launcherBuildJob.findMany({
|
||||
where: {
|
||||
...(query.target ? { target: query.target } : {}),
|
||||
...(since && Number.isFinite(since.getTime()) ? { createdAt: { gte: since } } : {}),
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 30,
|
||||
skip: (page - 1) * limit,
|
||||
take: limit,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1693,3 +1703,8 @@ echo "설치가 완료되었습니다."
|
||||
function safeMetadataValue(value: string) {
|
||||
return value.replace(/[^\x20-\x7E]/g, '').slice(0, 512);
|
||||
}
|
||||
|
||||
function toPositiveInt(value: string | undefined, fallback: number) {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user