Skip to content

Commit 6e2a76a

Browse files
committed
feat: enhance AttReportWithReportMonth service with update and delete methods
1 parent beb0a3a commit 6e2a76a

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎client/src/entities/att-report-with-report-month.jsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ const entity = {
8787
Inputs,
8888
filters,
8989
filterDefaultValues,
90-
editResource: 'att_report',
91-
deleteResource: 'att_report',
9290
};
9391

9492
export default getResourceComponents(entity);

‎server/src/entity-modules/att-report-with-report-month.config.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CrudRequest } from "@dataui/crud";
2-
import { In } from "typeorm";
1+
import { CrudRequest, Override } from "@dataui/crud";
2+
import { In, DeepPartial } from "typeorm";
33
import { BaseEntityModuleOptions, Entity } from "@shared/base-entity/interface";
44
import { IHeader } from "@shared/utils/exporter/types";
55
import { AttReportWithReportMonth } from "src/db/view-entities/AttReportWithReportMonth.entity";
@@ -70,6 +70,19 @@ function getConfig(): BaseEntityModuleOptions {
7070

7171

7272
class AttReportWithReportMonthService<T extends Entity | AttReportWithReportMonth> extends BaseEntityService<T> {
73+
@Override()
74+
async updateOne(req: CrudRequest<any>, dto: DeepPartial<T>): Promise<T> {
75+
const attReportService = new BaseEntityService(this.dataSource.getRepository(AttReport), this.mailSendService);
76+
await attReportService.updateOne(req, dto);
77+
return this.getOne(req);
78+
}
79+
80+
@Override()
81+
async deleteOne(req: CrudRequest<any>): Promise<void | T> {
82+
const attReportService = new BaseEntityService(this.dataSource.getRepository(AttReport), this.mailSendService);
83+
return attReportService.deleteOne(req) as Promise<void | T>;
84+
}
85+
7386
async doAction(req: CrudRequest<any, any>, body: any): Promise<any> {
7487
switch (req.parsed.extra.action) {
7588
case 'bulkKnownAbsences': {

0 commit comments

Comments
 (0)