init
This commit is contained in:
25
src/store/store.controller.ts
Normal file
25
src/store/store.controller.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
||||
import {StoreService} from './store.service';
|
||||
import {Store, StoreParams} from './store.schema';
|
||||
|
||||
@Controller('store')
|
||||
export class StoreController {
|
||||
constructor(
|
||||
private readonly storeService: StoreService
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
async findAll(): Promise<Store[]> {
|
||||
return this.storeService.findAll();
|
||||
}
|
||||
|
||||
@Get(':key?')
|
||||
async findOne(@Param() {key}: {key: string}): Promise<Store> {
|
||||
return this.storeService.findOne(key);
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() createStoreClass: StoreParams): Promise<Store> {
|
||||
return this.storeService.create(createStoreClass);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user