Skip to content

Commit

Permalink
feat(planners): define controller interface
Browse files Browse the repository at this point in the history
  • Loading branch information
inhibitor1217 committed Mar 20, 2024
1 parent 30aaf4f commit cc0d5e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/interfaces/dto/planner/planner.request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Transform, Type } from 'class-transformer';
import {
IsArray,
IsBoolean,
IsEnum,
IsInt,
IsNumber,
IsOptional,
Expand Down Expand Up @@ -56,3 +57,10 @@ export class PlannerBodyDto {
@IsInt({ each: true })
arbitrary_items_to_copy!: number[];
}

export class PlannerRemoveItemDto {
@IsInt()
item!: number;
@IsEnum(['TAKEN', 'FUTURE', 'ARBITRARY'])
item_type!: 'TAKEN' | 'FUTURE' | 'ARBITRARY';
}
11 changes: 11 additions & 0 deletions src/modules/planners/planners.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { GetUser } from 'src/common/decorators/get-user.decorator';
import {
PlannerBodyDto,
PlannerQueryDto,
PlannerRemoveItemDto,
} from 'src/common/interfaces/dto/planner/planner.request.dto';
import { PlannerResponseDto } from 'src/common/interfaces/dto/planner/planner.response.dto';
import { PlannersService } from './planners.service';

@Controller('api/users/:id/planners')
Expand Down Expand Up @@ -44,4 +46,13 @@ export class PlannersController {
const newPlanner = await this.plannersService.postPlanner(planner, user);
return newPlanner;
}

@Post(':plannerId/remove-item')
async removePlanner(
@Body() dto: PlannerRemoveItemDto,
@Param('plannerId') plannerId: number,
@GetUser() user: session_userprofile,
): Promise<PlannerResponseDto> {
throw new Error('Not implemented');
}
}

0 comments on commit cc0d5e7

Please sign in to comment.