feat: add Student-User association and activate all notification TODOs

This commit is contained in:
2026-07-05 23:42:22 +08:00
parent 9e6c136ef0
commit 9d9d4719b5
6 changed files with 116 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ import {
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
OneToOne,
JoinColumn,
OneToMany,
} from 'typeorm';
@@ -12,6 +13,7 @@ import { Occupancy } from './occupancy.entity';
import { PersonalExpense } from './personal-expense.entity';
import { Bill } from './bill.entity';
import { Tenant } from './tenant.entity';
import { User } from './user.entity';
@Entity('students')
export class Student {
@@ -59,6 +61,13 @@ export class Student {
@OneToMany(() => Occupancy, (o) => o.student)
occupancies: Occupancy[];
@Column({ name: 'user_id', type: 'integer', nullable: true, unique: true })
userId: number;
@OneToOne(() => User, { nullable: true })
@JoinColumn({ name: 'user_id' })
user: User;
@Column({ name: 'tenant_id', type: 'integer', nullable: true })
tenantId: number;