finalized application acceptance system and started making types shared across front and backend
This commit is contained in:
@@ -32,6 +32,7 @@ export interface ApplicationData {
|
||||
aknowledgeRules: boolean;
|
||||
}
|
||||
|
||||
//reflects how applications are stored in the database
|
||||
export interface ApplicationRow {
|
||||
id: number;
|
||||
member_id: number;
|
||||
@@ -43,7 +44,7 @@ export interface ApplicationRow {
|
||||
approved_at: string | null;
|
||||
denied_at: string | null;
|
||||
|
||||
app_status: Status; // generated column
|
||||
app_status: ApplicationStatus; // generated column
|
||||
decision_at: string | null; // generated column
|
||||
|
||||
// present when you join members (e.g., SELECT a.*, m.name AS member_name)
|
||||
@@ -64,7 +65,7 @@ export interface ApplicationFull {
|
||||
}
|
||||
|
||||
|
||||
export enum Status {
|
||||
export enum ApplicationStatus {
|
||||
Pending = "Pending",
|
||||
Accepted = "Accepted",
|
||||
Denied = "Denied",
|
||||
@@ -90,6 +91,7 @@ export async function postApplication(val: any) {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(out),
|
||||
credentials: 'include',
|
||||
})
|
||||
return res;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ export async function postChatMessage(message: any, post_id: number) {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function getAllApplications() {
|
||||
export async function getAllApplications(): Promise<ApplicationFull> {
|
||||
const res = await fetch(`${addr}/application/all`)
|
||||
|
||||
if (res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user