Добавлен контроллер пользователей, описана схема, подключен сервис для работы с БД, описана первая ручка для получения списка пользователей
This commit is contained in:
63
src/users/users.schema.ts
Normal file
63
src/users/users.schema.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||
import { Document } from 'mongoose';
|
||||
import {ApiProperty} from '@nestjs/swagger';
|
||||
|
||||
interface Token {
|
||||
token: string;
|
||||
expired_at: string;
|
||||
}
|
||||
|
||||
export class UserRequest {
|
||||
@ApiProperty()
|
||||
login: string;
|
||||
|
||||
@ApiProperty()
|
||||
avatar: string;
|
||||
|
||||
@ApiProperty()
|
||||
is_admin: string;
|
||||
}
|
||||
|
||||
@Schema()
|
||||
export class User extends Document {
|
||||
@Prop({
|
||||
required: true,
|
||||
unique: true,
|
||||
type: String,
|
||||
})
|
||||
login: string;
|
||||
|
||||
@Prop({
|
||||
required: true,
|
||||
type: String,
|
||||
})
|
||||
password: string;
|
||||
|
||||
@Prop({
|
||||
type: String,
|
||||
})
|
||||
avatar: string;
|
||||
|
||||
@Prop({
|
||||
type: Boolean,
|
||||
})
|
||||
is_admin: boolean;
|
||||
|
||||
@Prop({
|
||||
type: {
|
||||
token: String,
|
||||
expired_at: String,
|
||||
}
|
||||
})
|
||||
access_token: Token;
|
||||
|
||||
@Prop({
|
||||
type: {
|
||||
token: String,
|
||||
expired_at: String,
|
||||
}
|
||||
})
|
||||
refresh_token: Token;
|
||||
}
|
||||
|
||||
export const UserSchema = SchemaFactory.createForClass(User);
|
||||
Reference in New Issue
Block a user