refactor(server): auth dtos (#4881)

* refactor: auth dtos

* chore: open api
This commit is contained in:
Jason Rasmussen
2023-11-09 10:14:15 -05:00
committed by GitHub
parent 5c602bf4d4
commit 5423f1c25b
38 changed files with 187 additions and 657 deletions
+9 -6
View File
@@ -32,18 +32,21 @@ import {
LOGIN_URL,
MOBILE_REDIRECT,
} from './auth.constant';
import { AuthUserDto, ChangePasswordDto, LoginCredentialDto, OAuthCallbackDto, OAuthConfigDto, SignUpDto } from './dto';
import {
AdminSignupResponseDto,
AuthDeviceResponseDto,
AuthUserDto,
ChangePasswordDto,
LoginCredentialDto,
LoginResponseDto,
LogoutResponseDto,
OAuthAuthorizeResponseDto,
OAuthCallbackDto,
OAuthConfigDto,
OAuthConfigResponseDto,
mapAdminSignupResponse,
SignUpDto,
mapLoginResponse,
mapUserToken,
} from './response-dto';
} from './auth.dto';
export interface LoginDetails {
isSecure: boolean;
@@ -133,7 +136,7 @@ export class AuthService {
return this.userCore.updateUser(authUser, authUser.id, { password: newPassword });
}
async adminSignUp(dto: SignUpDto): Promise<AdminSignupResponseDto> {
async adminSignUp(dto: SignUpDto): Promise<UserResponseDto> {
const adminUser = await this.userRepository.getAdmin();
if (adminUser) {
@@ -149,7 +152,7 @@ export class AuthService {
storageLabel: 'admin',
});
return mapAdminSignupResponse(admin);
return mapUser(admin);
}
async validate(headers: IncomingHttpHeaders, params: Record<string, string>): Promise<AuthUserDto> {