Integrated application chat system
This commit is contained in:
@@ -49,14 +49,24 @@ export interface ApplicationRow {
|
||||
// present when you join members (e.g., SELECT a.*, m.name AS member_name)
|
||||
member_name: string;
|
||||
}
|
||||
export interface CommentRow {
|
||||
comment_id: number;
|
||||
post_content: string;
|
||||
poster_id: number;
|
||||
post_time: string;
|
||||
last_modified: string | null;
|
||||
poster_name: string;
|
||||
}
|
||||
|
||||
export interface ApplicationFull {
|
||||
application: ApplicationRow;
|
||||
comments: CommentRow[];
|
||||
}
|
||||
|
||||
export type ApplicationFull = ApplicationRow & {
|
||||
messages?: object[];
|
||||
};
|
||||
|
||||
export enum Status {
|
||||
Pending = "Pending",
|
||||
Approved = "Approved",
|
||||
Accepted = "Accepted",
|
||||
Denied = "Denied",
|
||||
}
|
||||
|
||||
@@ -83,19 +93,19 @@ export async function postApplication(val: any) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function postChatMessage(val: any) {
|
||||
export async function postChatMessage(message: any, post_id: number) {
|
||||
|
||||
let output = {
|
||||
message: val,
|
||||
sender: 1,
|
||||
timestamp: Date.now(),
|
||||
const out = {
|
||||
message: message
|
||||
}
|
||||
|
||||
await fetch(`http://${addr}/application/message`, {
|
||||
const response = await fetch(`http://${addr}/application/${post_id}/comment`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(output),
|
||||
body: JSON.stringify(out),
|
||||
})
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function getAllApplications() {
|
||||
|
||||
Reference in New Issue
Block a user