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';
export class CreatePeopleDto {
@IsString()
@IsNotEmpty()
firstname: string;
@IsString()
@IsNotEmpty()
lastname: string;
@IsOptional()
passwordHash: string;
@IsString()
@IsNotEmpty()
email: string;
@IsNotEmpty()
role: number;
}
\ No newline at end of file
import { IsBoolean, IsString, IsNotEmpty, IsOptional, IsNumber } from 'class-validator';
export class CreatePeopleDto {
@IsNumber()
@IsNotEmpty()
ine: number;
@IsString()
@IsNotEmpty()
firstname: string;
@IsString()
@IsNotEmpty()
lastname: string;
@IsOptional()
passwordHash: string;
@IsString()
@IsNotEmpty()
email: string;
@IsNotEmpty()
role: number;
}
import { IsOptional, IsString, IsNotEmpty } from 'class-validator';
export class UpdatePeopleDto {
@IsString()
@IsOptional()
firstname: string;
@IsString()
@IsOptional()
lastname: string;
@IsString()
@IsOptional()
email: string;
@IsString()
@IsOptional()
passwordHash: string;
@IsOptional()
role: number;
}
\ No newline at end of file
import { IsOptional, IsString, IsNotEmpty, IsNumber } from 'class-validator';
export class UpdatePeopleDto {
@IsNumber()
@IsNotEmpty()
ine: number;
@IsString()
@IsOptional()
firstname: string;
@IsString()
@IsOptional()
lastname: string;
@IsString()
@IsOptional()
email: string;
@IsString()
@IsOptional()
passwordHash: string;
@IsOptional()
role: number;
}
import { People } from '../schemas/people.schema';
export class PeopleEntity {
_id: string;
firstname: string;
lastname: string;
email: string;
passwordHash: string;
role: number;
constructor(partial: Partial<People>) {
Object.assign(this, partial);
}
}
\ No newline at end of file
import { People } from '../schemas/people.schema';
export class PeopleEntity {
_id: string;
ine: number;
firstname: string;
lastname: string;
email: string;
passwordHash: string;
role: number;
constructor(partial: Partial<People>) {
Object.assign(this, partial);
}
}
import * as mongoose from 'mongoose';
import { Document } from 'mongoose';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
export type PeopleDocument = People & Document;
@Schema({
toJSON: {
virtuals: true,
transform: (doc: any, ret: any) => {
delete ret._id;
},
},
})
export class People {
@Prop({
type: mongoose.Schema.Types.ObjectId,
auto: true,
})
_id: any;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) firstname: string;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) lastname: string;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) email: string;
@Prop({
type: String,
trim: true,
minlength: 2,
}) passwordHash: string;
@Prop({
type: Number,
required: true,
}) role: number;
}
export const PeopleSchema = SchemaFactory.createForClass(People);
PeopleSchema.index({});
\ No newline at end of file
import * as mongoose from 'mongoose';
import { Document } from 'mongoose';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
export type PeopleDocument = People & Document;
@Schema({
toJSON: {
virtuals: true,
transform: (doc: any, ret: any) => {
delete ret._id;
},
},
})
export class People {
@Prop({
type: mongoose.Schema.Types.ObjectId,
auto: true,
})
_id: any;
@Prop({
type: Number,
required: true,
}) ine: number;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) firstname: string;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) lastname: string;
@Prop({
type: String,
required: true,
trim: true,
minlength: 2,
}) email: string;
@Prop({
type: String,
trim: true,
minlength: 2,
}) passwordHash: string;
@Prop({
type: Number,
required: true,
}) role: number;
}
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