parent
ad738f2c61
commit
4a2c479879
4 changed files with 72 additions and 27 deletions
@ -1,17 +1,18 @@ |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; |
||||
import { AdminService } from './admin.service'; |
||||
import { Injectable, UnauthorizedException } from '@nestjs/common'; |
||||
import { InjectModel } from '@nestjs/sequelize'; |
||||
import { Admin } from './entities/admin.entity'; |
||||
import * as bcrypt from 'bcrypt'; |
||||
import { JwtService } from '@nestjs/jwt'; |
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from "@nestjs/common"; |
||||
import { AdminService } from "./admin.service"; |
||||
import { Admin } from "./entities/admin.entity"; |
||||
|
||||
@Controller('admin') |
||||
@Controller("admin") |
||||
export class AdminController { |
||||
constructor(private readonly adminService: AdminService) {} |
||||
@Post('register') |
||||
async register(@Body() body:{email: string, password: string}):Promise<Admin>{ |
||||
const {email, password} = body |
||||
@Post("register") |
||||
async register(@Body() body: { email: string; password: string }): Promise<Admin> { |
||||
const { email, password } = body; |
||||
return this.adminService.register(email, password); |
||||
} |
||||
@Post("login") |
||||
async login(@Body() body: { email: string; password: string }): Promise<{ token: string }> { |
||||
const { email, password } = body; |
||||
return this.adminService.login(email, password); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue