This repository has been archived by the owner on Oct 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.d.ts
89 lines (73 loc) · 2.03 KB
/
globals.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
declare type UserRole = "guest" | "individual" | "organization";
interface Client {
registered: boolean;
role: UserRole;
// TODO: define other fields of a user
}
declare type APIRequest = import("express").Request & {
payload: import("firebase-admin").auth.DecodedIdToken
};
declare type APIResponse = import("express").Response;
interface APIEndpointHandler {
method: "get" | "post" | "patch" | "put" | "delete" | "head" | "options" | "use";
path: string;
pre?: Array<import("express").Handler>;
allowGuest?: boolean;
handler(this: import("./src/server/index"), req: APIRequest, res: APIResponse): void;
}
declare type ID = { id: string; }
declare type IndividualForm = {
firstname: string;
lastname: string;
causes: string[];
zip: string;
skills: string[];
age: string;
}
declare type IndividualDocument = {
email: string;
picture: string;
following: string[];
location: FirebaseFirestore.GeoPoint;
} & IndividualForm & ID;
declare type OrganizationForm = {
title: string;
mission: string;
causes: string[];
zip: string;
contact: string;
url: string;
}
declare type OrganizationDocument = {
email: string;
picture: string;
location: FirebaseFirestore.GeoPoint;
events: string[];
ratings: string[];
followers: string[];
} & OrganizationForm & ID;
declare type RatingForm = {
stars: number;
description: string;
}
declare type RatingDocument = {
owner: string; // individuals's ID
} & RatingForm;
declare type OrgEventForm = {
title: string;
details: string;
zip: string;
skills: string[];
date: number;
}
declare type OrgEventDocument = {
owner: string; // org's ID
location: FirebaseFirestore.GeoPoint;
} & OrgEventForm;
declare type FilterOptions = {
causes: string[];
skills: string[];
distance: number;
}
declare type DatabaseNames = "inds"|"orgs"|"ratings"|"events";
// Add more types as you need