Compare commits

..

No commits in common. "677732d511447965cd4e48a868199fc7079693be" and "a2e05b4d59e4ca740e55eb19d42fa2b29d4c8b55" have entirely different histories.

3 changed files with 6 additions and 45 deletions

View File

@ -35,21 +35,16 @@ export class ReportBookmarkController {
return await this.service.getAll(query);
}
// @Get(':id')
// async get(@Param('id') id: string) {
// return await this.service.getOne(id);
// }
@Get('id')
async get(@Param('id') id: string) {
return await this.service.getOne(id);
}
@Get('label-history')
async getAllLabelHistory(@Query() query: GetLabelReportBookmarkDto) {
return await this.service.getAllLabelHistory(query);
}
@Get('applied')
async currentApplied(@Query() query: GetLabelReportBookmarkDto) {
return await this.service.getCurrentAppliedBookmark(query);
}
@Put('applied/:id')
async applied(@Param('id') id: string) {
return await this.service.applied(id);

View File

@ -25,11 +25,7 @@ export class ReportBookmarkService extends BaseReportService {
async create(body: CreateReportBookmarkDto) {
const newPayload = this.injectDefaultColumnCreate(body);
const result = await this.repo.save(newPayload);
if (body.applied) {
await this.appliedFalseBookmark(result.id);
}
return result;
return await this.repo.save(newPayload);
}
async getAll(query: GetReportBookmarkDto) {
@ -96,35 +92,6 @@ export class ReportBookmarkService extends BaseReportService {
return newData.map((el) => el.ReportBookmarkModel_label);
}
async getCurrentAppliedBookmark(query: GetLabelReportBookmarkDto) {
const modelName = ReportBookmarkModel.name;
const creator_id = this.getUser().id;
const unique_names = query.unique_names;
const group_names = query.group_names;
const types = query.types;
const qb = this.repo
.createQueryBuilder(modelName)
.where((query) => {
if (unique_names) {
query.andWhere(`unique_name IN (:...unique_names)`, { unique_names });
}
if (group_names) {
query.andWhere(`group_name IN (:...group_names)`, { group_names });
}
if (types) {
query.andWhere(`type IN (:...types)`, { types });
}
query.andWhere(`creator_id = :creator_id`, { creator_id });
query.andWhere(`applied = :applied`, { applied: true });
})
.orderBy(`${modelName}.created_at`, 'DESC');
return await qb.getMany();
}
async applied(id: string) {
await this.repo
.createQueryBuilder()

View File

@ -8,9 +8,8 @@ export class CreateReportExportDto extends GetReportDataDto {
@IsString()
time_zone: string;
@ApiProperty({ name: 'file_name', required: false })
@ApiProperty({ name: 'file_name', required: true })
@IsString()
@IsOptional()
file_name?: string;
@ApiProperty({