parent
be0f01bc1a
commit
2c5af3a06c
5 changed files with 83 additions and 0 deletions
@ -0,0 +1,34 @@ |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; |
||||
import { AdminService } from './admin.service'; |
||||
import { CreateAdminDto } from './dto/create-admin.dto'; |
||||
import { UpdateAdminDto } from './dto/update-admin.dto'; |
||||
|
||||
@Controller('admin') |
||||
export class AdminController { |
||||
constructor(private readonly adminService: AdminService) {} |
||||
|
||||
@Post() |
||||
create(@Body() createAdminDto: CreateAdminDto) { |
||||
return this.adminService.create(createAdminDto); |
||||
} |
||||
|
||||
@Get() |
||||
findAll() { |
||||
return this.adminService.findAll(); |
||||
} |
||||
|
||||
@Get(':id') |
||||
findOne(@Param('id') id: string) { |
||||
return this.adminService.findOne(+id); |
||||
} |
||||
|
||||
@Patch(':id') |
||||
update(@Param('id') id: string, @Body() updateAdminDto: UpdateAdminDto) { |
||||
return this.adminService.update(+id, updateAdminDto); |
||||
} |
||||
|
||||
@Delete(':id') |
||||
remove(@Param('id') id: string) { |
||||
return this.adminService.remove(+id); |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
import { Module } from '@nestjs/common'; |
||||
import { AdminService } from './admin.service'; |
||||
import { AdminController } from './admin.controller'; |
||||
|
||||
@Module({ |
||||
controllers: [AdminController], |
||||
providers: [AdminService], |
||||
}) |
||||
export class AdminModule {} |
@ -0,0 +1,26 @@ |
||||
import { Injectable } from '@nestjs/common'; |
||||
import { CreateAdminDto } from './dto/create-admin.dto'; |
||||
import { UpdateAdminDto } from './dto/update-admin.dto'; |
||||
|
||||
@Injectable() |
||||
export class AdminService { |
||||
create(createAdminDto: CreateAdminDto) { |
||||
return 'This action adds a new admin'; |
||||
} |
||||
|
||||
findAll() { |
||||
return `This action returns all admin`; |
||||
} |
||||
|
||||
findOne(id: number) { |
||||
return `This action returns a #${id} admin`; |
||||
} |
||||
|
||||
update(id: number, updateAdminDto: UpdateAdminDto) { |
||||
return `This action updates a #${id} admin`; |
||||
} |
||||
|
||||
remove(id: number) { |
||||
return `This action removes a #${id} admin`; |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import { Model, Table, Column } from "sequelize-typescript"; |
||||
@Table |
||||
export class Admin extends Model<Admin> { |
||||
@Column |
||||
email: string; |
||||
|
||||
@Column |
||||
password: string; |
||||
|
||||
@Column |
||||
role: string; |
||||
} |
Loading…
Reference in new issue