-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
apps/backend/src/application-period/application-period.service.ts
Outdated
Show resolved
Hide resolved
@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)); | ||
} |
There was a problem hiding this comment.
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
@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)); | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
apps/backend/src/application-period/application-period.service.ts
Outdated
Show resolved
Hide resolved
apps/backend/src/application-period/application-period.service.ts
Outdated
Show resolved
Hide resolved
apps/backend/src/application-period/application-period.service.ts
Outdated
Show resolved
Hide resolved
On the create-application dto I don't see any validation, aren't those needed? |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.