Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added basic crud for application periods #17

Merged
merged 4 commits into from
Aug 20, 2024

Conversation

FearsomeRover
Copy link
Contributor

Closes #3
Sry, dunno, why I thought it was #4, so the branch name is wrong.
It seems to be quite painful to fetch all application periods for checking the overlaps. Maybe we can reconsider this.

Comment on lines +34 to +62
@UseGuards(AuthGuard('jwt'), RolesGuard)
@ApiBearerAuth()
@Roles(Role.BODY_ADMIN, Role.BODY_MEMBER)
@Post()
async create(
@Body() createApplicationPeriodDto: CreateApplicationPeriodDto,
@CurrentUser() user: User
): Promise<ApplicationPeriod> {
return this.applicationPeriodService.create(createApplicationPeriodDto, user);
}

@UseGuards(AuthGuard('jwt'), RolesGuard)
@ApiBearerAuth()
@Roles(Role.BODY_ADMIN, Role.BODY_MEMBER)
@Delete(':id')
async delete(@Param('id') id: string): Promise<ApplicationPeriod> {
return this.applicationPeriodService.delete(Number(id));
}

@UseGuards(AuthGuard('jwt'), RolesGuard)
@ApiBearerAuth()
@Roles(Role.BODY_ADMIN, Role.BODY_MEMBER)
@Patch(':id')
async update(
@Body() updateApplicationPeriodDto: UpdateApplicationPeriodDto,
@Param() id: string
): Promise<ApplicationPeriod> {
return this.applicationPeriodService.update(updateApplicationPeriodDto, Number(id));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this was discussed with them, but maybe it'd make sense if only the body admin could do these

Comment on lines +19 to +32
@Get()
async findAll(@Query() getApplicationPeriodsDto: GetApplicationPeriodsDto): Promise<SimpleApplicationPeriodDto[]> {
return this.applicationPeriodService.findAll(getApplicationPeriodsDto);
}

@Get('current')
async getCurrentPeriod(): Promise<ApplicationPeriod> {
return this.applicationPeriodService.getCurrentPeriod();
}

@Get(':id')
async findOne(@Param('id') id: string): Promise<ApplicationPeriod> {
return this.applicationPeriodService.findOne(Number(id));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do regular users need access to the findAll and findOne methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see the point of them not seeing it. But we should discuss the permissions regardless

@Dkrisztan
Copy link
Contributor

On the create-application dto I don't see any validation, aren't those needed?

Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
schbody-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 8:02pm

@FearsomeRover FearsomeRover merged commit 652bd0a into main Aug 20, 2024
5 checks passed
@FearsomeRover FearsomeRover deleted the feat/4-application-period-crud branch August 20, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Application period CRUD endpoints on backend
3 participants