From 1b86dcef9fd537db800e0df2c2f3889ffbc69723 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Mar 2021 06:44:05 +0300 Subject: feat: add products service --- src/models/product/product.model.ts | 4 ++++ src/models/product/product.schema.ts | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/models/product/product.model.ts create mode 100644 src/models/product/product.schema.ts (limited to 'src/models/product') diff --git a/src/models/product/product.model.ts b/src/models/product/product.model.ts new file mode 100644 index 0000000..557b5be --- /dev/null +++ b/src/models/product/product.model.ts @@ -0,0 +1,4 @@ +import { Model, model } from 'mongoose'; +import { ProductSchema, productSchema } from './product.schema'; + +export default model>('Product', productSchema); diff --git a/src/models/product/product.schema.ts b/src/models/product/product.schema.ts new file mode 100644 index 0000000..8f488f3 --- /dev/null +++ b/src/models/product/product.schema.ts @@ -0,0 +1,18 @@ +import { Document, Schema, Types } from 'mongoose'; + +export interface ProductSchema extends Document { + name: string; + description: string; + price: number; + quantity: number; + specs: any; +} + +export const productSchema = new Schema({ + name: String, + description: String, + price: Number, + quantity: Number, + specs: Object +}, { timestamps: true }); + -- cgit v1.2.3