katoikia-app/service-a/src/books/schemas/book.schema.ts

28 lines
433 B
TypeScript
Raw Normal View History

2022-06-29 02:30:10 +00:00
import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
2022-07-25 04:38:48 +00:00
import { Document } from 'mongoose';
2022-06-29 02:30:10 +00:00
2022-07-25 04:38:48 +00:00
export type BookDocument = Book & Document;
2022-06-29 02:30:10 +00:00
2022-07-25 04:38:48 +00:00
@Schema()
2022-06-29 02:30:10 +00:00
export class Book {
2022-07-25 04:38:48 +00:00
@Prop()
2022-06-29 02:30:10 +00:00
genre: string;
@Prop()
description: string;
@Prop()
author: string;
@Prop()
pages: number;
@Prop()
image_url: string;
2022-07-25 04:38:48 +00:00
@Prop([String])
2022-06-29 02:30:10 +00:00
keywords: string[];
}
2022-07-25 04:38:48 +00:00
export const BookSchema = SchemaFactory.createForClass(Book);