forked from Cutlery/immich
* Fix lint issues and some other TS issues - set TypeScript in strict mode - add npm commands to lint / check code - fix all lint issues - fix some TS issues - rename User reponse DTO to make it consistent with the other ones - override Express/User interface to use UserResponseDto interface This is for when the accessing the `user` from a Express Request, like in `asset-upload-config` * Fix the rest of TS issues - fix all the remaining TypeScript errors - add missing `@types/mapbox__mapbox-sdk` package * Move global.d.ts to server `src` folder * Update AssetReponseDto duration type This is now of type `string` that defaults to '0:00:00.00000' if not set which is what the mobile app currently expects * Set context when logging error in asset.service Use `ServeFile` as the context for logging an error when asset.resizePath is not set * Fix wrong AppController merge conflict resolution `redirectToWebpage` was removed in main as is no longer used.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { Body, Controller, Post, UseGuards, ValidationPipe } from '@nestjs/common';
|
|
import { AuthUserDto, GetAuthUser } from '../../decorators/auth-user.decorator';
|
|
import { JwtAuthGuard } from '../../modules/immich-jwt/guards/jwt-auth.guard';
|
|
import { AuthService } from './auth.service';
|
|
import { LoginCredentialDto } from './dto/login-credential.dto';
|
|
import { SignUpDto } from './dto/sign-up.dto';
|
|
|
|
@Controller('auth')
|
|
export class AuthController {
|
|
constructor(private readonly authService: AuthService) {}
|
|
|
|
@Post('/login')
|
|
async login(@Body(ValidationPipe) loginCredential: LoginCredentialDto) {
|
|
return await this.authService.login(loginCredential);
|
|
}
|
|
|
|
@Post('/admin-sign-up')
|
|
async adminSignUp(@Body(ValidationPipe) signUpCrendential: SignUpDto) {
|
|
return await this.authService.adminSignUp(signUpCrendential);
|
|
}
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
@Post('/validateToken')
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
async validateToken(@GetAuthUser() authUser: AuthUserDto) {
|
|
return {
|
|
authStatus: true,
|
|
};
|
|
}
|
|
}
|