147 lines
3.3 KiB
TypeScript
147 lines
3.3 KiB
TypeScript
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
import { Document, Types } from 'mongoose';
|
|
import { ObjectType, Field, ID, Int } from '@nestjs/graphql';
|
|
import { Base } from '@/models/base.model';
|
|
import { Person } from '@/models/person.model';
|
|
import { Company } from '@/models/company.model';
|
|
|
|
@ObjectType()
|
|
export class BuildIban {
|
|
@Field()
|
|
@Prop({ required: true })
|
|
iban: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
startDate: Date;
|
|
|
|
@Field()
|
|
@Prop({ required: true, default: new Date('2900-01-01T03:00:00+03:00') })
|
|
stopDate: Date;
|
|
|
|
@Field()
|
|
@Prop({ required: true, default: 'TR0000000000000' })
|
|
bankCode: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true, default: '????' })
|
|
xcomment: string;
|
|
}
|
|
|
|
@ObjectType()
|
|
export class BuildResponsible {
|
|
@Field(() => ID)
|
|
@Prop({ type: Types.ObjectId, ref: Company.name, required: true })
|
|
company: Types.ObjectId;
|
|
|
|
@Field(() => ID)
|
|
@Prop({ type: Types.ObjectId, ref: Person.name, required: true })
|
|
person: Types.ObjectId;
|
|
}
|
|
|
|
@ObjectType()
|
|
export class BuildInfo {
|
|
@Field()
|
|
@Prop({ required: true })
|
|
govAddressCode: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
buildName: string;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
buildNo: string;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
maxFloor: number;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
undergroundFloor: number;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
buildDate: Date;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
decisionPeriodDate: Date;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
taxNo: string;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
liftCount: number;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
heatingSystem: boolean;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
coolingSystem: boolean;
|
|
|
|
@Field()
|
|
@Prop({ required: true })
|
|
hotWaterSystem: boolean;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
blockServiceManCount: number;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
securityServiceManCount: number;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
garageCount: number;
|
|
|
|
@Field(() => Int)
|
|
@Prop({ required: true })
|
|
managementRoomId: number;
|
|
}
|
|
|
|
@ObjectType()
|
|
@Schema({ timestamps: true })
|
|
export class Build extends Base {
|
|
@Field(() => ID)
|
|
@Prop({ type: Types.ObjectId, ref: 'BuildType', required: true })
|
|
buildType: Types.ObjectId;
|
|
|
|
@Field()
|
|
@Prop({ required: true, unique: true })
|
|
collectionToken: string;
|
|
|
|
@Field(() => BuildInfo)
|
|
@Prop({ type: BuildInfo, required: true })
|
|
info: BuildInfo;
|
|
|
|
@Field(() => ID, { nullable: true })
|
|
@Prop({ type: Types.ObjectId, ref: 'Site' })
|
|
site?: Types.ObjectId;
|
|
|
|
@Field(() => ID, { nullable: true })
|
|
@Prop({ type: Types.ObjectId, ref: 'BuildAddress' })
|
|
address?: Types.ObjectId;
|
|
|
|
@Field(() => [ID], { nullable: true })
|
|
@Prop({ type: [{ type: Types.ObjectId, ref: 'BuildArea' }] })
|
|
areas?: Types.ObjectId[];
|
|
|
|
@Field(() => [BuildIban], { nullable: true })
|
|
@Prop({ type: [BuildIban] })
|
|
ibans?: BuildIban[];
|
|
|
|
@Field(() => [BuildResponsible], { nullable: true })
|
|
@Prop({ type: [BuildResponsible] })
|
|
responsibles?: BuildResponsible[];
|
|
}
|
|
|
|
export type BuildDocument = Build & Document;
|
|
export const BuildSchema = SchemaFactory.createForClass(Build);
|