feat(SPG-719) Season Period - API Index - tambahkan filter berdasarkan season type

pull/45/head
Aswin Ashar Abdullah 2024-07-31 16:19:30 +07:00
parent 0ac5754170
commit d7c4b27749
3 changed files with 14 additions and 0 deletions

View File

@ -4,6 +4,8 @@ import { EnumDays } from '../../constants';
export interface FilterSeasonPeriodEntity extends BaseFilterEntity {
start_date: Date;
end_date: Date;
season_type_ids: string[];
holiday_names: string[];
days: EnumDays[];
}

View File

@ -74,6 +74,12 @@ export class IndexSeasonPeriodManager extends BaseIndexManager<SeasonPeriodEntit
);
}
if (this.filterParam.season_type_ids) {
queryBuilder.andWhere(`user_privilege_id In (:...seasonIds)`, {
seasonIds: this.filterParam.season_type_ids,
});
}
return queryBuilder;
}
}

View File

@ -25,4 +25,10 @@ export class FilterSeasonPeriodDto
return Array.isArray(body.value) ? body.value : [body.value];
})
days: EnumDays[];
@ApiProperty({ type: ['string'], required: false })
@Transform((body) => {
return Array.isArray(body.value) ? body.value : [body.value];
})
season_type_ids: string[];
}