forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
32
src/client/entities/schema/branch.schema.ts
Normal file
32
src/client/entities/schema/branch.schema.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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({ required: true })
|
||||
code: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
city: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
state: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
address: string;
|
||||
|
||||
@Prop()
|
||||
phoneNumber?: string;
|
||||
}
|
||||
|
||||
export const BranchSchema = SchemaFactory.createForClass(BranchModel);
|
||||
|
||||
BranchSchema.index({ clientKey: 1, code: 1 }, { unique: true });
|
||||
25
src/client/entities/schema/client.schema.ts
Normal file
25
src/client/entities/schema/client.schema.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
|
||||
|
||||
export type ClientDocument = ClientModel & Document;
|
||||
|
||||
@Schema({ collection: "clients", versionKey: false })
|
||||
export class ClientModel {
|
||||
@Prop({ required: true, unique: true, type: Object })
|
||||
clientName: {
|
||||
persian: string;
|
||||
english: string;
|
||||
};
|
||||
|
||||
@Prop({ required: false, unique: true, type: Object })
|
||||
property: {
|
||||
smsApiKey: string;
|
||||
};
|
||||
|
||||
@Prop({ required: true, unique: false })
|
||||
useExpertMode: "legal" | "genuine";
|
||||
|
||||
@Prop({ required: true, unique: false })
|
||||
clientCode: number;
|
||||
}
|
||||
|
||||
export const ClientDbSchema = SchemaFactory.createForClass(ClientModel);
|
||||
Reference in New Issue
Block a user