Skip to content

Commit

Permalink
Remove extra prints
Browse files Browse the repository at this point in the history
  • Loading branch information
neetidesai committed Dec 4, 2024
1 parent 1434186 commit 76e4793
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
55 changes: 25 additions & 30 deletions apps/backend/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Controller, Get, Post, Body, Param, Put } from '@nestjs/common';
import { UserService } from './user.service';
import { NewUserInput } from '../dtos/newUserDTO';
import { ApiParam } from '@nestjs/swagger';
import { UserModel, UserStatus, EditUserModel, Role } from "./user.model";
import { UserModel, UserStatus, EditUserModel, Role } from './user.model';

/**
* The controller for user endpoints.
Expand All @@ -26,39 +26,34 @@ export class UserController {
return this.userService.postUser(userData, Role.ADMIN);
}


@Get(':id/sites')
public async getUserSites(@Param('id') userId?: number): Promise<any> {
return this.userService.getUserTables(userId);
}

@Put("/editUser/:id")
public async editUser(
@Param("id") userId?: number,
@Body() editUserModel?: EditUserModel
): Promise<UserModel> {
return this.userService.editUser(userId, editUserModel);
}

/**
* Gets users by their status.
* @param status The status to filter users by (e.g., Approved, Pending, Denied).
* @returns A list of users with the specified status.
*/
@Get("status/:status")
@ApiParam({
name: 'status',
description: 'The status to filter users by (e.g., Approved, Pending, Denied)',
enum: UserStatus,
})
public async getUserByStatus(
@Param("status") status: UserStatus
): Promise<UserModel[]> {
console.log(status);
return this.userService.getUserByStatus(status);
}



@Put('/editUser/:id')
public async editUser(
@Param('id') userId?: number,
@Body() editUserModel?: EditUserModel,
): Promise<UserModel> {
return this.userService.editUser(userId, editUserModel);
}

/**
* Gets users by their status.
* @param status The status to filter users by (e.g., Approved, Pending, Denied).
* @returns A list of users with the specified status.
*/
@Get('status/:status')
@ApiParam({
name: 'status',
description:
'The status to filter users by (e.g., Approved, Pending, Denied)',
enum: UserStatus,
})
public async getUserByStatus(
@Param('status') status: UserStatus,
): Promise<UserModel[]> {
return this.userService.getUserByStatus(status);
}
}
2 changes: 0 additions & 2 deletions apps/backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class UserService {
if (!data) {
throw new Error(`No user found with id: ${userId}`);
}
console.log(data);
return this.mapDynamoDBItemToUserModel(userId, data);
} catch (e) {
throw new Error(
Expand Down Expand Up @@ -56,7 +55,6 @@ export class UserService {
if (!data) {
throw new Error(`No user found with id: ${userId}`);
}
console.log(data);
const siteIds = data['siteIds'].L.map((item) => Number(item.N));
return siteIds;
} catch (e) {
Expand Down

0 comments on commit 76e4793

Please sign in to comment.