Skip to content
Snippets Groups Projects
Commit 65160870 authored by Nabilsenko's avatar Nabilsenko
Browse files

fix: added INE to people

parent 433a2532
Branches addStudentNum
No related tags found
1 merge request!16fix: added INE to people
import { IsBoolean, IsString, IsNotEmpty, IsOptional } from 'class-validator'; import { IsBoolean, IsString, IsNotEmpty, IsOptional, IsNumber } from 'class-validator';
export class CreatePeopleDto { export class CreatePeopleDto {
@IsString() @IsNumber()
@IsNotEmpty() @IsNotEmpty()
firstname: string; ine: number;
@IsString() @IsString()
@IsNotEmpty() @IsNotEmpty()
lastname: string; firstname: string;
@IsOptional() @IsString()
passwordHash: string; @IsNotEmpty()
lastname: string;
@IsString()
@IsNotEmpty() @IsOptional()
email: string; passwordHash: string;
@IsNotEmpty() @IsString()
role: number; @IsNotEmpty()
email: string;
}
\ No newline at end of file @IsNotEmpty()
role: number;
}
import { IsOptional, IsString, IsNotEmpty } from 'class-validator'; import { IsOptional, IsString, IsNotEmpty, IsNumber } from 'class-validator';
export class UpdatePeopleDto { export class UpdatePeopleDto {
@IsString()
@IsOptional() @IsNumber()
firstname: string; @IsNotEmpty()
ine: number;
@IsString()
@IsOptional() @IsString()
lastname: string; @IsOptional()
firstname: string;
@IsString()
@IsOptional() @IsString()
email: string; @IsOptional()
lastname: string;
@IsString()
@IsOptional() @IsString()
passwordHash: string; @IsOptional()
email: string;
@IsOptional()
role: number; @IsString()
@IsOptional()
} passwordHash: string;
\ No newline at end of file
@IsOptional()
role: number;
}
import { People } from '../schemas/people.schema'; import { People } from '../schemas/people.schema';
export class PeopleEntity { export class PeopleEntity {
_id: string; _id: string;
firstname: string; ine: number;
lastname: string; firstname: string;
email: string; lastname: string;
passwordHash: string; email: string;
role: number; passwordHash: string;
role: number;
constructor(partial: Partial<People>) {
Object.assign(this, partial); constructor(partial: Partial<People>) {
} Object.assign(this, partial);
} }
\ No newline at end of file }
import * as mongoose from 'mongoose'; import * as mongoose from 'mongoose';
import { Document } from 'mongoose'; import { Document } from 'mongoose';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
export type PeopleDocument = People & Document; export type PeopleDocument = People & Document;
@Schema({ @Schema({
toJSON: { toJSON: {
virtuals: true, virtuals: true,
transform: (doc: any, ret: any) => { transform: (doc: any, ret: any) => {
delete ret._id; delete ret._id;
}, },
}, },
}) })
export class People { export class People {
@Prop({ @Prop({
type: mongoose.Schema.Types.ObjectId, type: mongoose.Schema.Types.ObjectId,
auto: true, auto: true,
}) })
_id: any; _id: any;
@Prop({ @Prop({
type: String, type: Number,
required: true, required: true,
trim: true, }) ine: number;
minlength: 2,
}) firstname: string; @Prop({
type: String,
@Prop({ required: true,
type: String, trim: true,
required: true, minlength: 2,
trim: true, }) firstname: string;
minlength: 2,
}) lastname: string; @Prop({
type: String,
@Prop({ required: true,
type: String, trim: true,
required: true, minlength: 2,
trim: true, }) lastname: string;
minlength: 2,
}) email: string; @Prop({
type: String,
@Prop({ required: true,
type: String, trim: true,
trim: true, minlength: 2,
minlength: 2, }) email: string;
}) passwordHash: string;
@Prop({
@Prop({ type: String,
type: Number, trim: true,
required: true, minlength: 2,
}) role: number; }) passwordHash: string;
} @Prop({
type: Number,
export const PeopleSchema = SchemaFactory.createForClass(People); required: true,
}) role: number;
PeopleSchema.index({});
\ No newline at end of file }
export const PeopleSchema = SchemaFactory.createForClass(People);
PeopleSchema.index({});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment