feat: enhance club management features and member requests
- Updated the backend to include a new `requested_club_id` field in the registration request model. - Replaced the club memberships router with a new club join requests router for better management of membership applications. - Added API endpoints for listing public clubs and managing club join requests, improving user experience during registration and membership processes. - Enhanced the ClubsPage in the frontend to support member management and join requests, including new modals for adding members and handling requests. - Updated API utility functions to accommodate new endpoints for club join requests and public club listings.
This commit is contained in:
1 parent
7d476268b8
commit
0f08e8df58
13 files changed
+1313
-19
No files matched your search
@@ -95,10 +95,10 @@ export async function login(email, password) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function register(email, password, name) {
|
||||
export async function register(email, password, name, extra = {}) {
|
||||
return request('/api/auth/register', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, password, name })
|
||||
body: JSON.stringify({ email, password, name, ...extra }),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -202,6 +202,51 @@ export async function removeClubMember(clubId, profileId) {
|
||||
return request(`/api/clubs/${clubId}/members/${profileId}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
/** Aktive Vereine (öffentlich, für Registrierungswahl). */
|
||||
export async function listPublicClubsDirectory() {
|
||||
return request('/api/clubs/public-directory')
|
||||
}
|
||||
|
||||
/** Vereinsinternes Mitgliederverzeichnis (Trainer-/Co-Auswahl). */
|
||||
export async function clubMembersDirectory(clubId) {
|
||||
return request(`/api/clubs/${clubId}/members/directory`)
|
||||
}
|
||||
|
||||
/** Eigene Beitrittsanträge. */
|
||||
export async function getMyClubJoinRequests() {
|
||||
return request('/api/me/club-join-requests')
|
||||
}
|
||||
|
||||
export async function createClubJoinRequest(payload) {
|
||||
return request('/api/me/club-join-requests', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
export async function withdrawClubJoinRequest(requestId) {
|
||||
return request(`/api/me/club-join-requests/${requestId}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
/** Offene Anträge (Vereins-/Plattform-Admin). */
|
||||
export async function listClubJoinRequests(clubId) {
|
||||
return request(`/api/clubs/${clubId}/join-requests`)
|
||||
}
|
||||
|
||||
export async function acceptClubJoinRequest(clubId, requestId, roles = ['trainer']) {
|
||||
return request(`/api/clubs/${clubId}/join-requests/${requestId}/accept`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ roles }),
|
||||
})
|
||||
}
|
||||
|
||||
export async function rejectClubJoinRequest(clubId, requestId) {
|
||||
return request(`/api/clubs/${clubId}/join-requests/${requestId}/reject`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({}),
|
||||
})
|
||||
}
|
||||
|
||||
export async function listDivisions(clubId) {
|
||||
const query = clubId ? `?club_id=${clubId}` : ''
|
||||
return request(`/api/divisions${query}`)
|
||||
@@ -1069,6 +1114,14 @@ export const api = {
|
||||
addClubMember,
|
||||
updateClubMember,
|
||||
removeClubMember,
|
||||
listPublicClubsDirectory,
|
||||
clubMembersDirectory,
|
||||
getMyClubJoinRequests,
|
||||
createClubJoinRequest,
|
||||
withdrawClubJoinRequest,
|
||||
listClubJoinRequests,
|
||||
acceptClubJoinRequest,
|
||||
rejectClubJoinRequest,
|
||||
listDivisions,
|
||||
createDivision,
|
||||
updateDivision,
|
||||
|
||||
Reference in new issue
Block a user