Skip to content

Commit

Permalink
fix: Fix tsc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Nov 22, 2022
1 parent 83433f2 commit 88898df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/@neet/vschedule-api/src/adapters/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'routing-controllers';

import { CreateUser } from '../../app';
import { User } from '../../domain';
import { Methods } from '../generated/auth/signup';
import { RestPresenter } from '../mappers';

Expand All @@ -27,8 +28,11 @@ export class AuthController {

@Post('/login')
@Authorized()
public login(@Req() req: Request) {
return this._presenter.presentUser(req.user);
public login(@Req() req: Request, @Res() res: Response) {
if (req.user == null) {
return res.status(500);
}
return this._presenter.presentUser(req.user as User);
}

@Post('/logout')
Expand All @@ -45,7 +49,7 @@ export class AuthController {
@OnUndefined(204)
public verifyCredentials(@Req() req: Request) {
if (req.user != null) {
return this._presenter.presentUser(req.user);
return this._presenter.presentUser(req.user as User);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@neet/vschedule-api/src/infra/passport/passport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class Passport {
) {}

configure(): RequestHandler[] {
passport.serializeUser((user: User, done) => {
done(null, user.id);
passport.serializeUser((user, done) => {
done(null, (user as User).id);
});
passport.deserializeUser(async (id: string, done) => {
const user = await this._showUser.invoke(id);
Expand Down

0 comments on commit 88898df

Please sign in to comment.