Files
yara724api/src/client/entities/schema/branch.schema.ts
T
SepehrYahyaee 0c272f1e86 Add tenant-scoped insurer, staff and branch management APIs
Support all six staff roles and editable Fanavaran codes, insurer login accounts and optional branch details. Enforce tenant boundaries and role-specific fields, document setup and extend regression coverage.
2026-10-11 10:42:44 +03:30

42 lines
922 B
TypeScript

import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Types } from "mongoose";
export type BranchDocument = BranchModel & Document;
@Schema({ collection: "branches", versionKey: false, timestamps: true })
export class BranchModel {
@Prop({ required: true, type: Types.ObjectId, ref: "ClientModel" })
clientKey: Types.ObjectId;
@Prop({ required: true })
name: string;
@Prop({ type: String })
fullName?: string;
@Prop({ required: true })
code: string;
@Prop({ required: true })
city: string;
@Prop({ required: true })
state: string;
@Prop({ required: true })
address: string;
@Prop()
phoneNumber?: string;
@Prop({ type: Boolean, default: true })
isActive?: boolean;
@Prop({ type: Date })
activityStartDate?: Date;
}
export const BranchSchema = SchemaFactory.createForClass(BranchModel);
BranchSchema.index({ clientKey: 1, code: 1 }, { unique: true });