Skip to content

Commit

Permalink
Replaced user with user-entity in session-user (#567)
Browse files Browse the repository at this point in the history
Replaced req['user'] with req['userEntity'] in controller and changed type from GetUserDto to userEntity in controller and service

Co-authored-by: Kylee Fields <[email protected]>
Co-authored-by: Anna Hughes <[email protected]>
  • Loading branch information
3 people committed Aug 14, 2024
1 parent fc31d6d commit 1528fbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/session-user/session-user.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Body, Controller, Post, Req, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { Request } from 'express';
import { GetUserDto } from 'src/user/dtos/get-user.dto';
import {UserEntity} from '../entities/user.entity';
import { ControllerDecorator } from 'src/utils/controller.decorator';
import { FirebaseAuthGuard } from '../firebase/firebase-auth.guard';
import { UpdateSessionUserDto } from './dtos/update-session-user.dto';
Expand All @@ -22,7 +22,7 @@ export class SessionUserController {
@UseGuards(FirebaseAuthGuard)
async createSessionUser(@Req() req: Request, @Body() createSessionUserDto: UpdateSessionUserDto) {
return await this.sessionUserService.createSessionUser(
req['user'] as GetUserDto,
req['userEntity'] as UserEntity,
createSessionUserDto,
);
}
Expand All @@ -35,7 +35,7 @@ export class SessionUserController {
@UseGuards(FirebaseAuthGuard)
async complete(@Req() req: Request, @Body() updateSessionUserDto: UpdateSessionUserDto) {
return await this.sessionUserService.setSessionUserCompleted(
req['user'] as GetUserDto,
req['userEntity'] as UserEntity,
updateSessionUserDto,
true,
);
Expand All @@ -50,7 +50,7 @@ export class SessionUserController {
@UseGuards(FirebaseAuthGuard)
async incomplete(@Req() req: Request, @Body() updateSessionUserDto: UpdateSessionUserDto) {
return await this.sessionUserService.setSessionUserCompleted(
req['user'] as GetUserDto,
req['userEntity'] as UserEntity,
updateSessionUserDto,
false,
);
Expand Down
5 changes: 2 additions & 3 deletions src/session-user/session-user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { CourseEntity } from '../entities/course.entity';
import { SessionUserEntity } from '../entities/session-user.entity';
import { Logger } from '../logger/logger';
import { SessionService } from '../session/session.service';
import { GetUserDto } from '../user/dtos/get-user.dto';
import { STORYBLOK_STORY_STATUS_ENUM } from '../utils/constants';
import { formatCourseUserObject, formatCourseUserObjects } from '../utils/serialize';
import { SessionUserDto } from './dtos/session-user.dto';
Expand Down Expand Up @@ -86,7 +85,7 @@ export class SessionUserService {
});
}

public async createSessionUser({ user }: GetUserDto, { storyblokId }: UpdateSessionUserDto) {
public async createSessionUser(user: UserEntity, { storyblokId }: UpdateSessionUserDto) {
const session = await this.sessionService.getSessionByStoryblokId(storyblokId);

if (!session) {
Expand Down Expand Up @@ -132,7 +131,7 @@ export class SessionUserService {
}

public async setSessionUserCompleted(
{ user }: GetUserDto,
user : UserEntity,
{ storyblokId }: UpdateSessionUserDto,
completed: boolean,
) {
Expand Down

0 comments on commit 1528fbc

Please sign in to comment.