updated build-sites
This commit is contained in:
@@ -1,35 +1,55 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document, Types } from 'mongoose';
|
||||
import { ObjectType, Field, ID, Float } from '@nestjs/graphql';
|
||||
import { Base } from '@/models/base.model';
|
||||
import { Document, Types } from 'mongoose';
|
||||
|
||||
@ObjectType()
|
||||
@Schema({ timestamps: true })
|
||||
export class BuildArea extends Base {
|
||||
|
||||
@Field(() => ID)
|
||||
@Prop({ type: Types.ObjectId, ref: 'Build', required: true })
|
||||
build: Types.ObjectId;
|
||||
readonly _id: string;
|
||||
|
||||
@Field(() => Float)
|
||||
@Prop({ required: true })
|
||||
area: number;
|
||||
areaName: string;
|
||||
|
||||
@Field(() => Float)
|
||||
@Prop({ required: true })
|
||||
areaCode: string;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
areaType: string;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
areaDirection: string;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
areaGrossSize: number;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
areaNetSize: number;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
width: number;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
size: number;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
type: string;
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Prop({ type: Types.ObjectId, ref: 'Build', required: false })
|
||||
buildId?: Types.ObjectId;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
typeToken: string;
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Prop({ type: Types.ObjectId, ref: 'BuildType', required: false })
|
||||
partTypeId?: Types.ObjectId;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
description: string;
|
||||
}
|
||||
|
||||
export type BuildAreaDocument = BuildArea & Document;
|
||||
|
||||
28
backend/src/models/build-site.model.ts
Normal file
28
backend/src/models/build-site.model.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Types, Document } from 'mongoose';
|
||||
import { ObjectType, Field, ID } from '@nestjs/graphql';
|
||||
import { Base } from '@/models/base.model';
|
||||
|
||||
@ObjectType()
|
||||
@Schema({ timestamps: true })
|
||||
export class BuildSites extends Base {
|
||||
|
||||
@Field(() => ID)
|
||||
readonly _id: string;
|
||||
|
||||
@Field(() => String)
|
||||
@Prop({ required: true })
|
||||
siteName: string;
|
||||
|
||||
@Field(() => String)
|
||||
@Prop({ required: true })
|
||||
siteNo: string;
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Prop({ type: Types.ObjectId, ref: 'BuildAddress', required: false })
|
||||
address?: Types.ObjectId;
|
||||
|
||||
}
|
||||
|
||||
export type BuildSiteDocument = BuildSites & Document;
|
||||
export const BuildSiteSchema = SchemaFactory.createForClass(BuildSites);
|
||||
@@ -1,12 +1,17 @@
|
||||
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 { Base, ChangableBase } from '@/models/base.model';
|
||||
import { Person } from '@/models/person.model';
|
||||
import { Company } from '@/models/company.model';
|
||||
|
||||
@ObjectType()
|
||||
export class BuildIban {
|
||||
@Schema({ timestamps: true })
|
||||
export class BuildIban extends ChangableBase {
|
||||
|
||||
@Field(() => ID)
|
||||
readonly _id: string;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true })
|
||||
iban: string;
|
||||
@@ -16,7 +21,7 @@ export class BuildIban {
|
||||
startDate: Date;
|
||||
|
||||
@Field()
|
||||
@Prop({ required: true, default: new Date('2900-01-01T03:00:00+03:00') })
|
||||
@Prop({ required: true })
|
||||
stopDate: Date;
|
||||
|
||||
@Field()
|
||||
@@ -26,6 +31,7 @@ export class BuildIban {
|
||||
@Field()
|
||||
@Prop({ required: true, default: '????' })
|
||||
xcomment: string;
|
||||
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
@@ -38,6 +44,7 @@ export class BuildResponsible {
|
||||
@Field(() => ID)
|
||||
@Prop({ type: Types.ObjectId, ref: Person.name, required: true })
|
||||
person: Types.ObjectId;
|
||||
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
@@ -126,7 +133,7 @@ export class Build extends Base {
|
||||
info: BuildInfo;
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Prop({ type: Types.ObjectId, ref: 'Site' })
|
||||
@Prop({ type: Types.ObjectId, ref: 'BuildSites' })
|
||||
site?: Types.ObjectId;
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@@ -147,5 +154,8 @@ export class Build extends Base {
|
||||
|
||||
}
|
||||
|
||||
export type BuildIbanDocument = BuildIban & Document;
|
||||
export const BuildIbanSchema = SchemaFactory.createForClass(BuildIban);
|
||||
|
||||
export type BuildDocument = Build & Document;
|
||||
export const BuildSchema = SchemaFactory.createForClass(Build);
|
||||
|
||||
Reference in New Issue
Block a user