add service and first method to controller

This commit is contained in:
Николай Вигдоров
2025-03-01 23:54:08 +03:00
parent 83ad4d43cd
commit 12b3d5b23c
10 changed files with 632 additions and 17 deletions

53
src/schemas.ts Normal file
View File

@ -0,0 +1,53 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { ApiProperty } from '@nestjs/swagger';
import { Document } from 'mongoose';
import { Storage } from './types';
export class AuthRequest {
@ApiProperty()
login: string;
}
@Schema()
export class UserDocument extends Document {
@Prop({
type: String,
required: true,
})
login: string;
@Prop({
type: String,
required: true,
})
token: string;
}
@Schema()
export class StorageDocument extends Document {
@Prop({
type: Object,
required: true,
})
data: object;
@Prop({
type: String,
required: true,
})
user: string;
}
export const StorageScheme = SchemaFactory.createForClass(StorageDocument);
export const UserScheme = SchemaFactory.createForClass(UserDocument);
export class StorageResponse implements Storage {
@ApiProperty()
data: object;
@ApiProperty()
user: string;
@ApiProperty()
id: string;
}