Skip to content

Commit 1581769

Browse files
authored
Fix challenger volunteer (#863)
## Description ### Summary <!--Brief description of what this PR does.--> ### Related Issues <!-- If applicable --> Closes #<!--0--> ## Changes Made <!--Please describe the changes made in this pull request--> - fix volunteer shift return schema - fix competition user payments endpoint access for school BDS ## Type of Change - [x] 🐛 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 🔨 Refactor (non-breaking change that neither fixes a bug nor adds a feature) - [ ] 🔧 Infra CI/CD (changes to configs of workflows) - [ ] 💥 BREAKING CHANGE (fix or feature that require a new minimal version of the front-end) ## Impact & Scope - [ ] Core functionality changes - [x] Single module changes - [ ] Multiple modules changes - [ ] Database migrations required - [ ] Other ## Testing - [x] Added/modified tests that pass the CI - [ ] Tested in a pre-prod - [ ] Tested this locally ## Documentation - [ ] Updated docs accordingly (docs.myecl.fr) : <!--[Docs#0 - Title](https://github.com/aeecleclair/myecl-documentation/pull/0)--> - [ ] Code includes docstrings - [x] No documentation needed ## Checklist - [x] My code follows the style guidelines of this project - [x] I have commented my code, particularly in hard-to-understand areas - [x] Any dependent changes have been merged and published (_Indicate the linked PR for the dependent changes_) ## Additional Notes Add any other context, screenshots, or information about the pull request here.
1 parent f1af46a commit 1581769

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

app/modules/sport_competition/endpoints_sport_competition.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3283,9 +3283,28 @@ async def get_payments_by_user_id(
32833283
32843284
**User must get his own payments or be competition admin to use this endpoint**
32853285
"""
3286+
competition_groups = (
3287+
await cruds_sport_competition.load_user_competition_groups_memberships(
3288+
user.id,
3289+
edition.id,
3290+
db,
3291+
)
3292+
)
3293+
user_db = await cruds_users.get_user_by_id(db, user_id)
3294+
if not user_db:
3295+
raise HTTPException(
3296+
status_code=404,
3297+
detail="The user does not exist.",
3298+
)
3299+
32863300
if not (
32873301
user_id == user.id
32883302
or is_user_member_of_any_group(user, [GroupType.competition_admin])
3303+
or (
3304+
CompetitionGroupType.schools_bds
3305+
in [competition_group.group for competition_group in competition_groups]
3306+
and user.school_id == user_db.school_id
3307+
)
32893308
):
32903309
raise HTTPException(
32913310
status_code=403,
@@ -3525,7 +3544,7 @@ async def get_payment_url(
35253544

35263545
@module.router.get(
35273546
"/competition/volunteers/shifts",
3528-
response_model=list[schemas_sport_competition.VolunteerShift],
3547+
response_model=list[schemas_sport_competition.VolunteerShiftComplete],
35293548
status_code=200,
35303549
)
35313550
async def get_all_volunteer_shifts(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = [{ name = "AEECL ECLAIR" }]
66

77
# Hyperion follows Semantic Versioning
88
# https://semver.org/
9-
version = "4.9.5"
9+
version = "4.9.6"
1010
minimal-titan-version-code = 139
1111
requires-python = ">= 3.11, < 3.13"
1212

0 commit comments

Comments
 (0)