forked from wangziqi/gongxue-base
refactor: resolve remaining field audit issues
This commit is contained in:
@@ -11,6 +11,12 @@ import {
|
||||
import { Classroom } from './classroom.entity';
|
||||
import { Organization } from './organization.entity';
|
||||
|
||||
export enum ClassroomRentalStatus {
|
||||
ACTIVE = 'active',
|
||||
ENDED = 'ended',
|
||||
CANCELLED = 'cancelled',
|
||||
}
|
||||
|
||||
@Entity('classroom_rentals')
|
||||
@Index(['classroomId', 'startDate', 'endDate'])
|
||||
export class ClassroomRental {
|
||||
@@ -57,8 +63,8 @@ export class ClassroomRental {
|
||||
@Column({ name: 'total_amount', type: 'decimal', precision: 10, scale: 2, nullable: true })
|
||||
totalAmount: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 20, default: 'active' })
|
||||
status: string; // active / ended / cancelled
|
||||
@Column({ type: 'varchar', length: 20, default: ClassroomRentalStatus.ACTIVE })
|
||||
status: ClassroomRentalStatus | 'active' | 'ended' | 'cancelled';
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
notes: string;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';
|
||||
|
||||
export enum ClassroomStatus {
|
||||
AVAILABLE = 'available',
|
||||
MAINTENANCE = 'maintenance',
|
||||
ARCHIVED = 'archived',
|
||||
}
|
||||
|
||||
@Entity('classrooms')
|
||||
export class Classroom {
|
||||
@@ -20,14 +26,12 @@ export class Classroom {
|
||||
@Column({ name: 'room_type', type: 'varchar', length: 20, default: '大' })
|
||||
roomType: string; // 大 / 次大 / 小
|
||||
|
||||
|
||||
@Column({ type: 'varchar', length: 20, default: 'reserved' })
|
||||
status: string;
|
||||
@Column({ type: 'varchar', length: 20, default: ClassroomStatus.AVAILABLE })
|
||||
status: ClassroomStatus | 'available' | 'maintenance' | 'archived';
|
||||
|
||||
@Column({ type: 'text', nullable: true })
|
||||
notes: string;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ export { User } from './user.entity';
|
||||
export { OperationLog } from './operation-log.entity';
|
||||
export { Deposit } from './deposit.entity';
|
||||
export { DepositInstallment } from './deposit-installment.entity';
|
||||
export { Classroom } from './classroom.entity';
|
||||
export { Classroom, ClassroomStatus } from './classroom.entity';
|
||||
export { Organization } from './organization.entity';
|
||||
export { ClassroomRental } from './classroom-rental.entity';
|
||||
export { ClassroomRental, ClassroomRentalStatus } from './classroom-rental.entity';
|
||||
export { Permission } from './permission.entity';
|
||||
export { Role } from './role.entity';
|
||||
export { Class, ClassType, ClassStatus } from './class.entity';
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, OneToMany, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
OneToMany,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
} from 'typeorm';
|
||||
import { Occupancy } from './occupancy.entity';
|
||||
import { RoomExpense } from './room-expense.entity';
|
||||
|
||||
@@ -26,7 +34,7 @@ export class Room {
|
||||
roomType: string;
|
||||
|
||||
@Column({ length: 10, nullable: true })
|
||||
gender: string;
|
||||
gender: '男' | '女' | null;
|
||||
|
||||
@Column({ name: 'rental_category', length: 10, default: 'short' })
|
||||
rentalCategory: string;
|
||||
@@ -42,5 +50,4 @@ export class Room {
|
||||
|
||||
@OneToMany(() => RoomExpense, (e) => e.room)
|
||||
roomExpenses: RoomExpense[];
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user