updated graphql dtos & build and it depends
This commit is contained in:
parent
42983eab65
commit
2e329d8dfe
|
|
@ -6,7 +6,6 @@ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
|||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { UsersModule } from './users/users.module';
|
||||
import { PeopleModule } from './people/people.module';
|
||||
import { BuildService } from './build/build.service';
|
||||
import { BuildModule } from './build/build.module';
|
||||
import { BuildPartsModule } from './build-parts/build-parts.module';
|
||||
import { BuildAreaModule } from './build-area/build-area.module';
|
||||
|
|
@ -20,14 +19,14 @@ import { UserTypesModule } from './user-types/user-types.module';
|
|||
playground: true,
|
||||
}),
|
||||
MongooseModule.forRoot(process.env.MONGODB_URI || "mongodb://evyosdbuser:evyosdbpassword@10.10.2.13:27017/evyosdb"),
|
||||
BuildModule,
|
||||
UsersModule,
|
||||
PeopleModule,
|
||||
BuildModule,
|
||||
BuildPartsModule,
|
||||
BuildAreaModule,
|
||||
UserTypesModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService, BuildService],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule { }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { InputType } from "@nestjs/graphql";
|
||||
|
||||
import { InputType, Field } from "@nestjs/graphql";
|
||||
|
||||
@InputType()
|
||||
export class CreateBuildAreaInput {
|
||||
|
||||
@Field()
|
||||
uuid: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { InputType, Field, ID } from '@nestjs/graphql';
|
||||
import { InputType, Field } from '@nestjs/graphql';
|
||||
|
||||
|
||||
@InputType()
|
||||
export class CreateBuildPartsInput {
|
||||
|
||||
@Field()
|
||||
uuid: string;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { BuildResolver } from './build.resolver';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { BuildSchema } from '@/models/build.model';
|
||||
import { BuildService } from './build.service';
|
||||
|
||||
@Module({
|
||||
providers: [BuildResolver]
|
||||
imports: [MongooseModule.forFeature([{ name: 'Build', schema: BuildSchema }])],
|
||||
providers: [BuildResolver, BuildService]
|
||||
})
|
||||
export class BuildModule { }
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import type { GraphQLResolveInfo } from 'graphql';
|
|||
|
||||
@Resolver()
|
||||
export class BuildResolver {
|
||||
|
||||
constructor(private readonly buildService: BuildService) { }
|
||||
|
||||
@Query(() => [Build], { name: 'Builds' })
|
||||
|
|
@ -24,4 +25,5 @@ export class BuildResolver {
|
|||
async createBuild(@Args('input') input: CreateBuildInput): Promise<Build> {
|
||||
return this.buildService.create(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { InputType } from "@nestjs/graphql";
|
||||
|
||||
import { InputType, Field, ID } from "@nestjs/graphql";
|
||||
|
||||
@InputType()
|
||||
export class CreateBuildInput {
|
||||
|
||||
@Field()
|
||||
uuid: string;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,51 +1,74 @@
|
|||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
import { ObjectType, Field, ID, GraphQLISODateTime } from '@nestjs/graphql';
|
||||
import { Base } from '@/models/base.model';
|
||||
|
||||
@Schema({ timestamps: true })
|
||||
@ObjectType()
|
||||
export class Person extends Base {
|
||||
|
||||
@Field(() => ID)
|
||||
_id: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
firstName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
surname: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
middleName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
sexCode: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
personRef: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
personTag: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
fatherName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
motherName: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
countryCode: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Prop({ required: true, unique: true })
|
||||
@Field()
|
||||
nationalIdentityId: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
birthPlace: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field(() => GraphQLISODateTime)
|
||||
birthDate: Date;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
taxNo: string;
|
||||
|
||||
@Prop({ required: true })
|
||||
@Field()
|
||||
birthname: string;
|
||||
}
|
||||
|
||||
export type PersonDocument = Person & Document;
|
||||
export const PersonSchema = SchemaFactory.createForClass(Person);
|
||||
|
||||
// PersonSchema.index({ firstName: 1, surname: 1, middleName: 1 }, { unique: true });
|
||||
// PersonSchema.index({ nationalIdentityId: 1 }, { unique: true });
|
||||
|
|
|
|||
|
|
@ -1,7 +1,47 @@
|
|||
import { InputType, Field, ID } from '@nestjs/graphql';
|
||||
|
||||
import { InputType, Field, GraphQLISODateTime } from "@nestjs/graphql";
|
||||
|
||||
@InputType()
|
||||
export class CreatePersonInput {
|
||||
|
||||
@Field()
|
||||
firstName: string;
|
||||
|
||||
@Field()
|
||||
surname: string;
|
||||
|
||||
@Field()
|
||||
middleName: string;
|
||||
|
||||
@Field()
|
||||
sexCode: string;
|
||||
|
||||
@Field()
|
||||
personRef: string;
|
||||
|
||||
@Field()
|
||||
personTag: string;
|
||||
|
||||
@Field()
|
||||
fatherName: string;
|
||||
|
||||
@Field()
|
||||
motherName: string;
|
||||
|
||||
@Field()
|
||||
countryCode: string;
|
||||
|
||||
@Field()
|
||||
nationalIdentityId: string;
|
||||
|
||||
@Field()
|
||||
birthPlace: string;
|
||||
|
||||
@Field(() => GraphQLISODateTime)
|
||||
birthDate: Date;
|
||||
|
||||
@Field()
|
||||
taxNo: string;
|
||||
|
||||
@Field()
|
||||
birthname: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import { InputType, Field, ID } from '@nestjs/graphql';
|
||||
|
||||
import { InputType, Field } from '@nestjs/graphql';
|
||||
|
||||
@InputType()
|
||||
export class CreateUserTypesInput {
|
||||
|
||||
@Field()
|
||||
uuid: string;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { UserTypesResolver } from './user-types.resolver';
|
||||
import { UserTypesService } from './user-types.service';
|
||||
import { UserTypeSchema, UserType } from '@/models/user-type.model';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
|
||||
@Module({
|
||||
providers: [UserTypesResolver, UserTypesService]
|
||||
imports: [MongooseModule.forFeature([{ name: UserType.name, schema: UserTypeSchema }])],
|
||||
providers: [UserTypesResolver, UserTypesService],
|
||||
})
|
||||
export class UserTypesModule { }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import { UsersService } from './users.service';
|
|||
import { UserSchema, User } from '@/models/user.model';
|
||||
|
||||
@Module({
|
||||
imports: [MongooseModule.forFeature([{ name: User.name, schema: UserSchema }])],
|
||||
providers: [UsersResolver, UsersService],
|
||||
imports: [
|
||||
MongooseModule.forFeature([{ name: User.name, schema: UserSchema }])
|
||||
],
|
||||
providers: [UsersService, UsersResolver],
|
||||
})
|
||||
export class UsersModule { }
|
||||
Loading…
Reference in New Issue