init studio admin backend
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Body, Controller, Post, Req } from '@nestjs/common';
|
||||
|
||||
import { AdminAuthService } from './admin-auth.service';
|
||||
import { Public } from './decorators/admin-auth.decorators';
|
||||
import { AdminLoginDto } from './dto';
|
||||
|
||||
@Controller('auth/admin')
|
||||
export class AdminAuthController {
|
||||
constructor(private readonly adminAuthService: AdminAuthService) {}
|
||||
|
||||
@Public()
|
||||
@Post('login')
|
||||
login(
|
||||
@Body() body: AdminLoginDto,
|
||||
@Req() request: { ip?: string; headers: Record<string, string | string[] | undefined> },
|
||||
) {
|
||||
const userAgent = request.headers['user-agent'];
|
||||
|
||||
return this.adminAuthService.login(body, {
|
||||
ipAddress: request.ip,
|
||||
userAgent: Array.isArray(userAgent) ? userAgent.join(', ') : userAgent,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user