parent
238cd06920
commit
44b3017ce4
6 changed files with 56 additions and 14 deletions
@ -0,0 +1,22 @@ |
||||
import { Model, Table, Column, DataType } from "sequelize-typescript"; |
||||
|
||||
@Table |
||||
export class Product extends Model<Product> { |
||||
@Column({ |
||||
type: DataType.STRING, |
||||
allowNull: false, |
||||
}) |
||||
name: string; |
||||
|
||||
@Column({ |
||||
type: DataType.STRING, |
||||
allowNull: false, |
||||
}) |
||||
description: string; |
||||
|
||||
@Column({ |
||||
type: DataType.DECIMAL(10, 2), |
||||
allowNull: false, |
||||
}) |
||||
price: number; |
||||
} |
@ -0,0 +1,8 @@ |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; |
||||
import { ProductsService } from './products.service'; |
||||
|
||||
@Controller('products') |
||||
export class ProductsController { |
||||
constructor(private readonly productsService: ProductsService) {} |
||||
|
||||
} |
@ -0,0 +1,9 @@ |
||||
import { Module } from '@nestjs/common'; |
||||
import { ProductsService } from './products.service'; |
||||
import { ProductsController } from './products.controller'; |
||||
|
||||
@Module({ |
||||
controllers: [ProductsController], |
||||
providers: [ProductsService], |
||||
}) |
||||
export class ProductsModule {} |
@ -0,0 +1,6 @@ |
||||
import { Injectable } from '@nestjs/common'; |
||||
|
||||
@Injectable() |
||||
export class ProductsService { |
||||
|
||||
} |
Loading…
Reference in new issue