forked from wangziqi/gongxue-base
P2-14: Deposit installment tracking + refund approval flow
- Add DepositInstallment entity (id, depositId, amount, dueDate, paidDate, status, createdAt) - Add installments OneToMany relation to Deposit entity with cascade+eager - Add refund approval fields: refundStatus, refundRequestedAt, refundApprovedBy, refundApprovedAt - Add installment DTOs (CreateInstallmentDto, UpdateInstallmentDto) - Add refund approval DTOs (ApproveRefundDto, CreateDepositWithInstallmentsDto) - Service: add/create/update/delete installments, requestRefund, approveRefund, findPendingRefunds - Controller: GET deposits/:id, GET pending-refunds, POST :id/installments, PUT installments/:id, DELETE installments/:id, POST :id/request-refund, PUT :id/approve-refund - Frontend: detail modal with installment list, refund request button, pending refunds tab with approve actions
This commit is contained in:
37
apps/server/src/entities/deposit-installment.entity.ts
Normal file
37
apps/server/src/entities/deposit-installment.entity.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Deposit } from './deposit.entity';
|
||||
|
||||
@Entity('deposit_installments')
|
||||
export class DepositInstallment {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'deposit_id' })
|
||||
depositId: number;
|
||||
|
||||
@Column({ type: 'decimal', precision: 10, scale: 2 })
|
||||
amount: number;
|
||||
|
||||
@Column({ name: 'due_date', type: 'date' })
|
||||
dueDate: string;
|
||||
|
||||
@Column({ name: 'paid_date', type: 'date', nullable: true })
|
||||
paidDate: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, default: 'pending' })
|
||||
status: string; // pending | paid
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date;
|
||||
|
||||
@ManyToOne(() => Deposit, (d) => d.installments, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'deposit_id' })
|
||||
deposit: Deposit;
|
||||
}
|
||||
Reference in New Issue
Block a user