-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
449 show registrations for group (#508)
* Add fetch group registrations api * Show proposal title and description on secret groups table * Add min heigth to containers and remove console log
- Loading branch information
1 parent
037d138
commit ec56a3e
Showing
7 changed files
with
129 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { GetGroupRegistration } from './types/GroupRegistrationsType'; | ||
|
||
async function fetchGroupRegistrations(groupId: string): Promise<GetGroupRegistration | null> { | ||
try { | ||
const response = await fetch( | ||
`${import.meta.env.VITE_SERVER_URL}/api/groups/${groupId}/registrations`, | ||
{ | ||
credentials: 'include', | ||
headers: { | ||
'Content-type': 'application/json', | ||
}, | ||
}, | ||
); | ||
|
||
if (!response.ok) { | ||
throw new Error(`HTTP Error! Status: ${response.status}`); | ||
} | ||
|
||
const groups = (await response.json()) as { data: GetGroupRegistration }; | ||
return groups.data; | ||
} catch (error) { | ||
console.error('Error fetching group registrations:', error); | ||
return null; | ||
} | ||
} | ||
|
||
export default fetchGroupRegistrations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// This can be optimized | ||
|
||
type RegistrationField = { | ||
id: string; | ||
eventId: string; | ||
name: string; | ||
description: string | null; | ||
type: 'SELECT' | 'TEXT' | 'NUMBER' | 'DATE' | 'BOOLEAN'; | ||
required: boolean; | ||
fieldDisplayRank: number | null; | ||
characterLimit: number; | ||
forGroup: boolean; | ||
forUser: boolean; | ||
createdAt: string; | ||
updatedAt: string; | ||
}; | ||
|
||
type RegistrationData = { | ||
id: string; | ||
registrationId: string; | ||
registrationFieldId: string; | ||
value: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
registrationField: RegistrationField; | ||
}; | ||
|
||
type Registration = { | ||
id: string; | ||
userId: string; | ||
eventId: string; | ||
groupId: string; | ||
status: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
registrationData: RegistrationData[]; | ||
}; | ||
|
||
export type GetGroupRegistration = { | ||
id: string; | ||
name: string; | ||
description: string | null; | ||
groupCategoryId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
registrations: Registration[]; | ||
}[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters