-
@@ -29,11 +23,8 @@
diff --git a/frontend/stores/auth.ts b/frontend/stores/auth.ts
index eb26b4ad4..c92896c72 100644
--- a/frontend/stores/auth.ts
+++ b/frontend/stores/auth.ts
@@ -1,5 +1,3 @@
-import { defineStore } from "pinia";
-
export const useUser = defineStore("auth", {
state: () => ({
userIsSignedIn: false,
diff --git a/frontend/stores/event.ts b/frontend/stores/event.ts
new file mode 100644
index 000000000..3b2024af0
--- /dev/null
+++ b/frontend/stores/event.ts
@@ -0,0 +1,91 @@
+import type {
+ Event,
+ PiniaResEvent,
+ PiniaResEventText,
+} from "~/types/events/event";
+
+export const useEventStore = defineStore("event", {
+ // MARK: Properties
+
+ state: (): Event => ({
+ loading: false,
+
+ // event
+ id: "",
+ name: "",
+ tagline: "",
+ createdBy: "",
+ iconURL: "",
+ type: "learn",
+ offlineLocation: "",
+ getInvolvedURL: "",
+ socialLinks: [""],
+ startTime: "",
+
+ // event_organizations
+ organizations: [],
+
+ // event_text
+ description: "",
+ getInvolved: "",
+ }),
+ actions: {
+ async fetchByID(id: string | undefined) {
+ // MARK: API Calls
+
+ this.loading = true;
+
+ const [resEvent, resEventTexts] = await Promise.all([
+ useAsyncData(
+ async () => await fetchWithToken(`/entities/events/${id}`, {})
+ ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/event_faq?event_id=${id}`,
+ // {}
+ // )
+ // ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/event_resources?event_id=${id}`,
+ // {}
+ // )
+ // ),
+ useAsyncData(
+ async () =>
+ await fetchWithToken(`/entities/event_texts?event_id=${id}`, {})
+ ),
+ ]);
+
+ // MARK: Result Parsing
+
+ const eventRes = resEvent.data as unknown as PiniaResEvent;
+ // const eventFAQRes = resEventFAQ.data as unknown as PiniaResEvent;
+ // const eventResourcesRes =
+ // resEventResources.data as unknown as PiniaResEvent;
+ const eventTextsRes = resEventTexts.data as unknown as PiniaResEventText;
+
+ const event = eventRes._value;
+ // const faq = eventRes._value;
+ // const resources = eventRes._value;
+ const texts = eventTextsRes._value.results[0];
+
+ // MARK: Assignment
+
+ this.id = event.id;
+ this.name = event.name;
+ this.tagline = event.tagline;
+ this.iconURL = event.iconURL;
+ this.offlineLocation = event.offlineLocation;
+ this.getInvolvedURL = event.getInvolvedURL;
+ this.socialLinks = event.socialLinks;
+
+ this.description = texts.description;
+ this.getInvolved = texts.getInvolved;
+
+ this.loading = false;
+ },
+ },
+});
diff --git a/frontend/stores/group.ts b/frontend/stores/group.ts
new file mode 100644
index 000000000..03c2f9734
--- /dev/null
+++ b/frontend/stores/group.ts
@@ -0,0 +1,91 @@
+import type { PiniaResGroup, PiniaResGroupText } from "~/types/entities/group";
+import type { PiniaResOrganization } from "~/types/entities/organization";
+
+export const useGroupStore = defineStore("group", {
+ // MARK: Properties
+
+ state: () => ({
+ loading: false,
+
+ // group
+ id: "",
+ name: "",
+ tagline: "",
+ organization: "",
+ location: "",
+ getInvolvedURL: "",
+ socialLinks: [""],
+ status: 1,
+
+ // group_text
+ description: "",
+ getInvolved: "",
+ donationPrompt: "",
+ }),
+ actions: {
+ async fetchByID(id: string | undefined) {
+ // MARK: API Calls
+ this.loading = true;
+
+ const [resGroup, resGroupOrg, resGroupTexts] = await Promise.all([
+ useAsyncData(
+ async () => await fetchWithToken(`/entities/groups/${id}`, {})
+ ),
+ useAsyncData(
+ async () =>
+ await fetchWithToken(`/entities/organizations?group_id=${id}`, {})
+ ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/group_faq?group_id=${id}`,
+ // {}
+ // )
+ // ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/group_resources?group_id=${id}`,
+ // {}
+ // )
+ // ),
+ useAsyncData(
+ async () =>
+ await fetchWithToken(`/entities/group_texts?group_id=${id}`, {})
+ ),
+ ]);
+
+ // MARK: Result Parsing
+
+ const groupRes = resGroup.data as unknown as PiniaResGroup;
+ const groupOrgRes = resGroupOrg.data as unknown as PiniaResOrganization[];
+ // const groupFAQRes = resGroupFAQ.data as unknown as PiniaResGroup;
+ // const groupResourcesRes =
+ // resGroupResources.data as unknown as PiniaResGroup;
+ const groupTextsRes = resGroupTexts.data as unknown as PiniaResGroupText;
+
+ const group = groupRes._value;
+ const groupOrg = groupOrgRes[0]._value;
+ // const faq = groupRes._value;
+ // const groups = groupRes._value;
+ // const resources = groupRes._value;
+ const texts = groupTextsRes._value.results[0];
+
+ // MARK: Assignment
+
+ this.id = group.id;
+ this.name = group.name;
+ this.tagline = group.tagline;
+ this.organization = groupOrg.id;
+ this.location = group.location;
+ this.getInvolvedURL = group.getInvolvedURL;
+ this.socialLinks = group.socialLinks;
+
+ this.description = texts.description;
+ this.getInvolved = texts.getInvolved;
+ this.donationPrompt = texts.donationPrompt;
+
+ this.loading = false;
+ },
+ },
+});
diff --git a/frontend/stores/organization.ts b/frontend/stores/organization.ts
new file mode 100644
index 000000000..608082017
--- /dev/null
+++ b/frontend/stores/organization.ts
@@ -0,0 +1,238 @@
+import type {
+ Organization,
+ OrganizationText,
+ OrganizationTextFormData,
+ PiniaResOrganization,
+ PiniaResOrganizations,
+ PiniaResOrganizationText,
+ PiniaResOrganizationTexts,
+} from "~/types/entities/organization";
+
+interface OrganizationStore {
+ loading: boolean;
+ organization: Organization;
+ organizations: Organization[];
+}
+
+export const useOrganizationStore = defineStore("organization", {
+ // MARK: Properties
+
+ state: (): OrganizationStore => ({
+ loading: false,
+
+ // organization
+ organization: {
+ id: "",
+ name: "",
+ tagline: "",
+ createdBy: "",
+ iconURL: "",
+ location: "",
+ getInvolvedURL: "",
+ socialLinks: [""],
+ status: 1,
+
+ // organization_group
+ groups: [],
+
+ organization_text_id: "",
+ description: "",
+ getInvolved: "",
+ donationPrompt: "",
+ },
+
+ organizations: [],
+ }),
+ actions: {
+ async fetchByID(id: string | undefined) {
+ // MARK: Fetch By ID
+
+ this.loading = true;
+
+ const [resOrg, resOrgTexts] = await Promise.all([
+ useAsyncData(
+ async () => await fetchWithToken(`/entities/organizations/${id}`, {})
+ ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/organization_faq?org_id=${id}`,
+ // {}
+ // )
+ // ),
+ // useAsyncData(
+ // async () => await fetchWithToken(`/entities/groups?org_id=${id}`, {})
+ // ),
+ // useAsyncData(
+ // async () =>
+ // await fetchWithToken(
+ // `/entities/organization_resources?org_id=${id}`,
+ // {}
+ // )
+ // ),
+ useAsyncData(
+ async () =>
+ await fetchWithToken(
+ `/entities/organization_texts?org_id=${id}`,
+ {}
+ )
+ ),
+ ]);
+ const orgRes = resOrg.data as unknown as PiniaResOrganization;
+ // const orgFAQRes = resOrgFAQ.data as unknown as PiniaResOrganizationFAQ;
+ // const orgGroupRes = resOrgGroups.data as unknown as PiniaResOrganizationGroup;
+ // const orgResourcesRes =
+ // resOrgResources.data as unknown as PiniaResOrganizationResource;
+ const orgTextsRes =
+ resOrgTexts.data as unknown as PiniaResOrganizationText;
+
+ const organization = orgRes._value;
+ // const faq = orgRes._value;
+ // const groups = orgRes._value;
+ // const resources = orgRes._value;
+ const texts = orgTextsRes._value.results[0];
+
+ this.organization.id = organization.id;
+ this.organization.name = organization.name;
+ this.organization.tagline = organization.tagline;
+ this.organization.iconURL = organization.iconURL;
+ this.organization.location = organization.location;
+ this.organization.getInvolvedURL = organization.getInvolvedURL;
+ this.organization.socialLinks = organization.socialLinks;
+ this.organization.status = organization.status;
+
+ this.organization.groups = organization.groups;
+
+ this.organization.description = texts.description;
+ this.organization.getInvolved = texts.getInvolved;
+ this.organization.donationPrompt = texts.donationPrompt;
+ this.organization.organization_text_id = texts.id;
+
+ this.loading = false;
+ },
+ async fetchAll() {
+ // MARK: Fetch All
+
+ this.loading = true;
+
+ const [resOrgs] = await Promise.all([
+ useAsyncData(
+ async () => await fetchWithToken(`/entities/organizations/`, {})
+ ),
+ ]);
+
+ const orgs = resOrgs.data as unknown as PiniaResOrganizations;
+
+ if (orgs) {
+ const resOrgTexts = (await Promise.all(
+ orgs._value.map((org) =>
+ useAsyncData(
+ async () =>
+ await fetchWithToken(
+ `/entities/organization_texts?org_id=${org.id}`,
+ {}
+ )
+ )
+ )
+ )) as unknown as PiniaResOrganizationTexts[];
+
+ const orgTextsData = resOrgTexts.map(
+ (text) => text.data._value.results[0]
+ ) as unknown as OrganizationText[];
+
+ console.log(`Here: ${JSON.stringify(orgTextsData)}`);
+
+ const organizationsWithTexts = orgs._value.map(
+ (organization: Organization, index: number) => {
+ const texts = orgTextsData[index];
+ return {
+ id: organization.id,
+ name: organization.name,
+ tagline: organization.tagline,
+ createdBy: organization.createdBy,
+ iconURL: organization.iconURL,
+ location: organization.location,
+ getInvolvedURL: organization.getInvolvedURL,
+ socialLinks: organization.socialLinks,
+ status: organization.status,
+ groups: organization.groups,
+ organization_text_id: organization.organization_text_id,
+ description: texts.description,
+ getInvolved: texts.getInvolved,
+ donationPrompt: texts.donationPrompt,
+ };
+ }
+ );
+
+ this.organizations = organizationsWithTexts;
+ this.loading = false;
+ }
+ },
+ async save(organization: Organization) {
+ // MARK: Save
+
+ this.loading = true;
+
+ this.loading = false;
+ },
+ async updateTexts(org: Organization, formData: OrganizationTextFormData) {
+ // MARK: Update
+
+ this.loading = true;
+
+ const token = localStorage.getItem("accessToken");
+
+ const resOrg = await $fetch(
+ BASE_BACKEND_URL + `/entities/organizations/${org.id}/`,
+ {
+ method: "PUT",
+ body: {
+ ...org,
+ getInvolvedURL: formData.getInvolvedURL,
+ },
+ headers: {
+ Authorization: `Token ${token}`,
+ },
+ }
+ );
+
+ const resOrgTexts = await $fetch(
+ BASE_BACKEND_URL +
+ `/entities/organization_texts/${org.organization_text_id}/`,
+ {
+ method: "PUT",
+ body: {
+ primary: true,
+ description: formData.description,
+ getInvolved: formData.getInvolved,
+ donate_prompt: "",
+ org_id: org.id,
+ iso: 1,
+ },
+ headers: {
+ Authorization: `Token ${token}`,
+ },
+ }
+ );
+
+ if (resOrg && resOrgTexts) {
+ this.organization.description = formData.description;
+ this.organization.getInvolved = formData.getInvolved;
+ this.organization.getInvolvedURL = formData.getInvolvedURL;
+
+ this.loading = false;
+
+ return true;
+ }
+
+ return false;
+ },
+ async delete(id: string | undefined) {
+ // MARK: Delete
+
+ this.loading = true;
+
+ this.loading = false;
+ },
+ },
+});
diff --git a/frontend/stores/resource.ts b/frontend/stores/resource.ts
new file mode 100644
index 000000000..e69de29bb
diff --git a/frontend/types/user.d.ts b/frontend/types/auth/user.d.ts
similarity index 59%
rename from frontend/types/user.d.ts
rename to frontend/types/auth/user.d.ts
index 49f4455f4..1b0eb47ab 100644
--- a/frontend/types/user.d.ts
+++ b/frontend/types/auth/user.d.ts
@@ -1,5 +1,6 @@
+// MARK: Main Table
+
export interface User {
- // user
id: string;
user_name: string;
name: string;
@@ -10,17 +11,28 @@ export interface User {
// verificationMethod?: string;
// verificationPartner?: User;
email?: string;
- socialLinks?: string[];
+ socialLinks: string[];
// isPrivate: boolean;
// isHighRisk: boolean;
// creationDate: string;
- // user_resource
- // resources?: Resource[];
- // user_task
- // tasks?: Task[];
- // user_topic
- // topics?: string[];
// support
// supportingOrgs?: Organization[];
// supportingUsers?: User[];
}
+
+// MARK: Bridge Tables
+
+export interface UserResource {
+ userID: string;
+ resourceID: string;
+}
+
+export interface UserTask {
+ userID: string;
+ taskID: string;
+}
+
+export interface UserTopic {
+ userID: string;
+ topicID: string;
+}
diff --git a/frontend/types/content/discussion.d.ts b/frontend/types/content/discussion.d.ts
new file mode 100644
index 000000000..15f585239
--- /dev/null
+++ b/frontend/types/content/discussion.d.ts
@@ -0,0 +1,34 @@
+// MARK: Main Table
+
+export interface Discussion {
+ title: string;
+ createdBy: User;
+ orgID?: Organization;
+ eventID?: Event;
+ // voteID?: Vote;
+ category: string;
+ upVoters: User[];
+ participants: User[];
+ messages: number;
+ creationDate: string;
+}
+
+// MARK: Bridge Tables
+
+export interface DiscussionEntry {
+ id: number;
+ authorImg?: string;
+ author: string;
+ content: string;
+ votes: number;
+ date: datetime;
+}
+
+export interface DiscussionInput {
+ name: string;
+ location?: string;
+ supporters: number;
+ description: string;
+ category: string;
+ highRisk: boolean;
+}
diff --git a/frontend/types/faq-entry.d.ts b/frontend/types/content/faq-entry.d.ts
similarity index 100%
rename from frontend/types/faq-entry.d.ts
rename to frontend/types/content/faq-entry.d.ts
diff --git a/frontend/types/content/resource.d.ts b/frontend/types/content/resource.d.ts
new file mode 100644
index 000000000..0b1ba015a
--- /dev/null
+++ b/frontend/types/content/resource.d.ts
@@ -0,0 +1,33 @@
+import { Organization } from "../entities/organization";
+// MARK: Main Table
+
+export interface Resource {
+ id: string;
+ name: string;
+ createdBy: User;
+ description: string;
+ // category: string;
+ organization: Organization;
+ location: string;
+ resourceURL: string;
+ // isPrivate?: boolean;
+ creationDate?: string;
+ // lastUpdated?: string;
+}
+
+// MARK: Bridge Tables
+
+export interface ResourceStar {
+ resourceID: string;
+ user_id: string;
+}
+
+export interface ResourceTag {
+ resourceID: string;
+ tagID: string;
+}
+
+export interface ResourceTopic {
+ resourceID: string;
+ topicID: string;
+}
diff --git a/frontend/types/discussion-entry.d.ts b/frontend/types/discussion-entry.d.ts
deleted file mode 100644
index 7b8abfd58..000000000
--- a/frontend/types/discussion-entry.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface DiscussionEntry {
- id: number;
- authorImg?: string;
- author: string;
- content: string;
- votes: number;
- date: datetime;
-}
diff --git a/frontend/types/discussion-input.d.ts b/frontend/types/discussion-input.d.ts
deleted file mode 100644
index 0aab5a612..000000000
--- a/frontend/types/discussion-input.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface DiscussionInput {
- name: string;
- location?: string;
- supporters: number;
- description: string;
- category: string;
- highRisk: boolean;
-}
diff --git a/frontend/types/discussion.d.ts b/frontend/types/discussion.d.ts
deleted file mode 100644
index 0a4f3dca8..000000000
--- a/frontend/types/discussion.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export interface Discussion {
- title: string;
- createdBy: User;
- orgID?: Organization;
- eventID?: Event;
- // voteID?: Vote;
- category: string;
- upVoters: User[];
- participants: User[];
- messages: number;
- creationDate: string;
-}
diff --git a/frontend/types/entities/group.d.ts b/frontend/types/entities/group.d.ts
new file mode 100644
index 000000000..d473ce342
--- /dev/null
+++ b/frontend/types/entities/group.d.ts
@@ -0,0 +1,102 @@
+// MARK: Main Table
+
+export interface Group {
+ id: string;
+ name: string;
+ tagline: string;
+ organization: Organization;
+ createdBy: User;
+ // category?: string;
+ location: string;
+ getInvolvedURL: string;
+ socialLinks: string[];
+ creationDate: string;
+ // deletionDate: string;
+
+ // group_event
+ // events: Event[];
+
+ // faq
+ faqEntries?: FaqEntry[];
+
+ // group_resource
+ resources?: Resource[];
+
+ // group_text
+ description: string;
+ getInvolved: string;
+ donationPrompt: string;
+
+ // group_topic
+ // topics?: Topic[];
+
+ // support
+ // supportingOrgs?: Organization[];
+ // supportingUsers?: User[];
+}
+
+// MARK: Bridge Tables
+
+export interface GroupEvent {
+ groupID: string;
+ eventID: string;
+}
+
+export interface GroupImage {
+ groupID: string;
+ imageID: string;
+ sequenceIndex: number;
+}
+
+export interface GroupMember {
+ groupID: string;
+ userID: string;
+ isOwner: boolean;
+ isAdmin: boolean;
+ isComms: boolean;
+}
+
+export interface GroupResource {
+ groupID: string;
+ resourceID: string;
+}
+
+export interface GroupText {
+ groupID: string;
+ iso: string;
+ primary: boolean;
+ description: string;
+ getInvolved: string;
+ donationPrompt: string;
+}
+
+export interface GroupTopic {
+ groupID: string;
+ topicID: string;
+}
+
+// MARK: Pinia Responses
+
+export interface PiniaResGroup {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: Group;
+ _value: Group;
+}
+
+export interface PiniaResGroupText {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: GroupText[];
+ };
+ _value: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: GroupText[];
+ };
+}
diff --git a/frontend/types/entities/organization.d.ts b/frontend/types/entities/organization.d.ts
new file mode 100644
index 000000000..2276b01c1
--- /dev/null
+++ b/frontend/types/entities/organization.d.ts
@@ -0,0 +1,179 @@
+// MARK: Main Table
+
+export interface Organization {
+ id: string;
+ name: string;
+ tagline: string;
+ createdBy: string;
+ iconURL: string;
+ location: string;
+ getInvolvedURL: string;
+ socialLinks: string[];
+ status: number;
+ // statusUpdated?: string;
+ // acceptanceDate?: string;
+ // deletionDate?: string;
+
+ // organization_application
+ // orgsInFavor?: Organization[];
+ // orgsAgainst?: Organization[];
+ creationDate?: string;
+
+ // discussion
+ // discussions?: Discussion[];
+
+ // organization_event
+ // events?: Event[];
+
+ // faq
+ faqEntries?: FaqEntry[];
+
+ // organization_group
+ groups?: Group[];
+
+ // organization_resource
+ resources?: Resource[];
+
+ // organization_task
+ // task?: Task[];
+
+ organization_text_id: string;
+ description: string;
+ getInvolved: string;
+ donationPrompt: string;
+
+ // organization_topic
+ // topics?: Topic[];
+
+ // support
+ // supportingOrgs?: Organization[];
+ // supportingUsers?: User[];
+}
+
+// MARK: Bridge Tables
+
+export interface OrganizationEvent {
+ orgID: string;
+ eventID: string;
+}
+
+export interface OrganizationGroup {
+ orgID: string;
+ groupID: string;
+}
+
+export interface OrganizationImage {
+ orgID: string;
+ imageID: string;
+ sequenceIndex: number;
+}
+
+export interface OrganizationMember {
+ orgID: string;
+ userID: string;
+ isOwner: boolean;
+ isAdmin: boolean;
+ isComms: boolean;
+}
+
+export interface OrganizationResource {
+ orgID: string;
+ resourceID: string;
+}
+
+export interface OrganizationTask {
+ orgID: string;
+ taskID: string;
+}
+
+export interface OrganizationText {
+ id: string;
+ orgID: string;
+ iso: string;
+ primary: boolean;
+ description: string;
+ getInvolved: string;
+ donationPrompt: string;
+}
+
+export interface OrganizationTopic {
+ orgID: string;
+ topicID: string;
+}
+
+// MARK: Pinia Responses
+
+export interface PiniaResOrganization {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: Organization;
+ _value: Organization;
+}
+
+export interface PiniaResOrganizations {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: Organization[];
+ _value: Organization[];
+}
+
+export interface PiniaResOrganizationText {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: OrganizationText[];
+ };
+ _value: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: OrganizationText[];
+ };
+}
+
+export interface PiniaResOrganizationTexts {
+ data: {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: {
+ count: number;
+ next: null;
+ previous: null;
+ results: OrganizationText[];
+ };
+ _value: {
+ count: number;
+ next: null;
+ previous: null;
+ results: OrganizationText[];
+ };
+ };
+ pending: {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: boolean;
+ _value: boolean;
+ };
+ error: {
+ _object: { [$key: string]: null };
+ _key: string;
+ __v_isRef: boolean;
+ };
+ status: {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: string;
+ _value: string;
+ };
+}
+
+// MARK: Form Data
+
+export interface OrganizationTextFormData {
+ description: string;
+ getInvolved: string;
+ getInvolvedURL: string;
+}
diff --git a/frontend/types/event.d.ts b/frontend/types/event.d.ts
deleted file mode 100644
index 62001c778..000000000
--- a/frontend/types/event.d.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-export interface Event {
- // event
- id: string;
- name: string;
- tagline?: string;
- createdBy: User;
- iconURL?: string;
- type: "action" | "learn";
- onlineLocationLink?: string;
- offlineLocation?: string;
- offlineLocationLat?: string;
- offlineLocationLong?: string;
- getInvolvedURL?: string;
- socialLinks?: string[];
- startTime: string;
- endTime?: string;
- creationDate?: string;
- // deletionDate?: string;
- // event_attendee
- // attendees?: User[];
- // event_format
- // format?: string;
- // organization_event
- organizations: Organization[];
- // event_resources
- resources?: Resource[];
- // event_role
- // roles?: string[];
- // event_series
- // series?: string;
- // event_tag
- // tags: string[];
- // event_task
- // tasks: Task[];
- // event_text
- description?: string;
- getInvolved?: string;
- // event_topic
- // topics: string[];
- // discussion
- discussion?: DiscussionEntry[];
- // support
- // supportingOrgs?: Organization[];
- // supportingUsers?: User[];
-}
diff --git a/frontend/types/events/event.d.ts b/frontend/types/events/event.d.ts
new file mode 100644
index 000000000..eb4424b28
--- /dev/null
+++ b/frontend/types/events/event.d.ts
@@ -0,0 +1,120 @@
+// MARK: Main Table
+
+export interface Event {
+ id: string;
+ name: string;
+ tagline?: string;
+ createdBy: User;
+ iconURL?: string;
+ type: "action" | "learn";
+ onlineLocationLink?: string;
+ offlineLocation?: string;
+ offlineLocationLat?: string;
+ offlineLocationLong?: string;
+ getInvolvedURL?: string;
+ socialLinks: string[];
+ startTime: string;
+ endTime?: string;
+ creationDate?: string;
+ // deletionDate?: string;
+
+ // discussion
+ discussion?: DiscussionEntry[];
+
+ // event_organization
+ organizations: Organization[];
+
+ // event_resource
+ resources?: Resource[];
+
+ // event_task
+ // task?: Task[];
+
+ // event_text
+ description: string;
+ getInvolved: string;
+
+ // support
+ // supportingOrgs?: Organization[];
+ // supportingUsers?: User[];
+
+ loading: boolean;
+}
+
+// MARK: Bridge Tables
+
+export interface EventAttendee {
+ eventID: string;
+ userID: string;
+ roleID: string;
+ attendeeStatus: int;
+}
+
+export interface EventFormat {
+ eventID: string;
+ formatID: int;
+}
+
+export interface EventResource {
+ eventID: string;
+ resourceID: string;
+}
+
+export interface EventRole {
+ eventID: string;
+ roleID: string;
+}
+
+export interface EventSeries {
+ eventID: string;
+ seriesID: string;
+}
+
+export interface EventTag {
+ eventID: string;
+ tagID: string;
+}
+
+export interface EventTask {
+ eventID: string;
+ taskID: string;
+}
+
+export interface EventText {
+ eventID: string;
+ iso: string;
+ primary: boolean;
+ description: string;
+ getInvolved: string;
+}
+
+export interface EventTopic {
+ eventID: string;
+ topicID: string;
+}
+
+// MARK: Pinia Responses
+
+export interface PiniaResEvent {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: Event;
+ _value: Event;
+}
+
+export interface PiniaResEventText {
+ __v_isShallow: boolean;
+ __v_isRef: boolean;
+ _rawValue: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: EventText[];
+ };
+ _value: {
+ count: integer;
+ next: null;
+ previous: null;
+ results: EventText[];
+ };
+}
diff --git a/frontend/types/feed-item.d.ts b/frontend/types/feed/feed-item.d.ts
similarity index 100%
rename from frontend/types/feed-item.d.ts
rename to frontend/types/feed/feed-item.d.ts
diff --git a/frontend/types/feed.d.ts b/frontend/types/feed/feed.d.ts
similarity index 100%
rename from frontend/types/feed.d.ts
rename to frontend/types/feed/feed.d.ts
diff --git a/frontend/types/group.d.ts b/frontend/types/group.d.ts
deleted file mode 100644
index 9cab3d8f6..000000000
--- a/frontend/types/group.d.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-export interface Group {
- // group
- id: string;
- name: string;
- tagline?: string;
- organization: Organization;
- createdBy: User;
- // category?: string;
- location: string;
- getInvolvedURL?: string;
- socialLinks?: string[];
- creationDate?: string;
- // deletionDate?: string;
- // group_event
- // events?: Event[];
- // group_image
- images?: string[];
- // group_member
- // members?: User[];
- // owners?: User[];
- // admins?: User[];
- // comms?: User[];
- // group_resources
- resources?: Resource[];
- // group_text
- description?: string;
- getInvolved?: string;
- // donationPrompt?: string;
- // group_topic
- // topics: string[];
- // faq
- faqEntries?: FaqEntry[];
- // support
- // supportingOrgs?: Organization[];
- // supportingUsers?: User[];
-}
diff --git a/frontend/types/menu-entry.ts b/frontend/types/menu/menu-entry.ts
similarity index 100%
rename from frontend/types/menu-entry.ts
rename to frontend/types/menu/menu-entry.ts
diff --git a/frontend/types/menu-selector.d.ts b/frontend/types/menu/menu-selector.d.ts
similarity index 100%
rename from frontend/types/menu-selector.d.ts
rename to frontend/types/menu/menu-selector.d.ts
diff --git a/frontend/types/organization.d.ts b/frontend/types/organization.d.ts
deleted file mode 100644
index 70c42a6c2..000000000
--- a/frontend/types/organization.d.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-export interface Organization {
- // organization
- id: string;
- name: string;
- tagline: string;
- createdBy: User;
- iconURL?: string;
- location: string;
- getInvolvedURL?: string;
- socialLinks?: string[];
- status: number;
- // statusUpdated?: string;
- // acceptanceDate?: string;
- // deletionDate?: string;
- // organization_application
- // orgsInFavor?: Organization[];
- // orgsAgainst?: Organization[];
- creationDate?: string;
- // organization_event
- // events?: Event[];
- // organization_group
- groups?: Group[];
- // organization_image
- images?: string[];
- // organization_member
- // members?: User[];
- // admins?: User[];
- // comms?: User[];
- // organization_resource
- resources?: Resource[];
- // organization_task
- // tasks?: Task[];
- // organization_text
- description?: string;
- getInvolved?: string;
- // donationPrompt?: string;
- // organization_topic
- // topics: string[];
- // discussion
- discussions?: Discussion[];
- // faq
- faqEntries?: FaqEntry[];
- // support
- // supportingOrgs?: Organization[];
- // supportingUsers?: User[];
-}
diff --git a/frontend/types/resource.d.ts b/frontend/types/resource.d.ts
deleted file mode 100644
index c67a2da81..000000000
--- a/frontend/types/resource.d.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export interface Resource {
- // resource
- id: string;
- name: string;
- createdBy: User;
- description: string;
- // category: string;
- location: string;
- resourceURL: string;
- // isPrivate?: boolean;
- creationDate?: string;
- // lastUpdated?: string;
- // resource_star
- // starers: User;
- // resource_tag
- // tags: string[];
- // resource_topic
- // topics?: string[];
- // group_resource
- group?: Group;
- // organization_resource
- organization: Organization;
-}
diff --git a/frontend/utils/testEntities.ts b/frontend/utils/testEntities.ts
index 65f53c278..5b0d27b10 100644
--- a/frontend/utils/testEntities.ts
+++ b/frontend/utils/testEntities.ts
@@ -1,10 +1,10 @@
-import type { Discussion } from "~/types/discussion";
-import type { Event } from "~/types/event";
-import type { FaqEntry } from "~/types/faq-entry";
-import type { Group } from "~/types/group";
-import type { Organization } from "~/types/organization";
-import type { Resource } from "~/types/resource";
-import type { User } from "~/types/user";
+import type { User } from "~/types/auth/user";
+import type { Discussion } from "~/types/content/discussion";
+import type { FaqEntry } from "~/types/content/faq-entry";
+import type { Resource } from "~/types/content/resource";
+import type { Group } from "~/types/entities/group";
+import type { Organization } from "~/types/entities/organization";
+import type { Event } from "~/types/events/event";
export const testUser: User = {
id: "1",
@@ -12,6 +12,7 @@ export const testUser: User = {
name: "John A. Tester",
location: "Testerville, TN",
description: "I love to test!",
+ socialLinks: [""],
// topics: ["Testing"],
};
@@ -36,19 +37,21 @@ const faqEntries = [faqEntry_01, faqEntry_02, faqEntry_03];
export const testClimateOrg: Organization = {
id: "1",
name: "Berlin Climate Org",
- createdBy: testUser,
+ createdBy: "c7eb5449-fe45-4fb3-a4ee-25ed0bd0a675",
status: 2,
tagline: "Fighting Climate Change",
location: "Berlin, Germany",
getInvolvedURL: "/",
- description:
- "Nulla aliqua sit fugiat commodo excepteur deserunt dolor ullamco Lorem. Esse aliquip nisi ullamco pariatur velit officia. Eiusmod commodo nulla consequat minim laboris pariatur adipisicing. Veniam amet nostrud id cupidatat. Esse duis velit elit duis non labore adipisicing sunt eu nostrud. Occaecat mollit et do consectetur fugiat amet.",
// topics: ["Environment"],
// members: [testUser, testUser],
// supportingUsers: [testUser, testUser],
groups: ["Fundraising", "Campaigning"],
socialLinks: ["climate-org@mastodon", "climate-org@email"],
- // donationPrompt: "Hey thanks!",
+ iconURL: "URL/for/image",
+ organization_text_id: "06cb36a3-13c5-4518-b676-33ec734744ed",
+ description: "Testing how organizations work",
+ getInvolved: "Hey, get involved!",
+ donationPrompt: "Hey thanks!",
faqEntries: faqEntries,
};
@@ -64,6 +67,10 @@ export const testTechGroup1: Group = {
// topics: ["Technology and Privacy"],
// members: [testUser, testUser, testUser],
// supportingUsers: [testUser, testUser, testUser],
+ socialLinks: [""],
+ creationDate: "",
+ getInvolved: "Hey, get involved!",
+ donationPrompt: "Thanks for your support!",
faqEntries: faqEntries,
};
@@ -79,6 +86,10 @@ export const testTechGroup2: Group = {
// topics: ["Technology and Privacy"],
// members: [testUser, testUser, testUser],
// supportingUsers: [testUser, testUser, testUser],
+ socialLinks: [""],
+ creationDate: "",
+ getInvolved: "Hey, get involved!",
+ donationPrompt: "Thanks for your support!",
faqEntries: faqEntries,
};
@@ -97,12 +108,10 @@ export const testTechOrg: Organization = {
id: "1",
name: "tech from below",
tagline: "Technologie von und für soziale Bewegungen",
- createdBy: testUser,
+ createdBy: "c7eb5449-fe45-4fb3-a4ee-25ed0bd0a675",
status: 2,
location: "Berlin, Germany",
getInvolvedURL: "/",
- description:
- "Nulla aliqua sit fugiat commodo excepteur deserunt dolor ullamco Lorem. Esse aliquip nisi ullamco pariatur velit officia. Eiusmod commodo nulla consequat minim laboris pariatur adipisicing. Veniam amet nostrud id cupidatat. Esse duis velit elit duis non labore adipisicing sunt eu nostrud. Occaecat mollit et do consectetur fugiat amet.",
// topics: ["Environment"],
// members: [testUser, testUser],
// supportingUsers: [testUser, testUser],
@@ -110,7 +119,10 @@ export const testTechOrg: Organization = {
groups: [testTechGroup1, testTechGroup2],
socialLinks: ["tfb@mastodon", "tfb@email"],
// donationPrompt: "Hey thanks!",
- discussions: [testDiscussion, testDiscussion],
+ organization_text_id: "06cb36a3-13c5-4518-b676-33ec734744ed",
+ description: "Testing how organizations work",
+ getInvolved: "Hey, get involved!",
+ donationPrompt: "Hey thanks!",
faqEntries: faqEntries,
};
@@ -133,6 +145,7 @@ export const testClimateEvent: Event = {
// supportingUsers: [user, user],
// iconURL: "/images/an_image.svg",
socialLinks: ["climate_org@mastodon", "climate_org@email.com"],
+ loading: false,
};
export const testTechEvent: Event = {
@@ -146,8 +159,11 @@ export const testTechEvent: Event = {
description: "Let's fix some bugs!",
getInvolved: "Squash some bugs!",
offlineLocation: "Berlin",
+ // attending: [user, user],
startTime: new Date().toLocaleDateString(),
// supportingUsers: [user, user, user],
+ socialLinks: [""],
+ loading: false,
};
export const testResource: Resource = {
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index ab43c55b9..cf287a3ec 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -3282,11 +3282,11 @@ brace-expansion@^2.0.1:
balanced-match "^1.0.0"
braces@^3.0.2, braces@~3.0.2:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
- integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
+ integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
- fill-range "^7.0.1"
+ fill-range "^7.1.1"
browserslist@^4.0.0, browserslist@^4.22.2, browserslist@^4.23.0:
version "4.23.0"
@@ -4799,10 +4799,10 @@ file-uri-to-path@1.0.0:
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
-fill-range@^7.0.1:
- version "7.0.1"
- resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
- integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
+fill-range@^7.1.1:
+ version "7.1.1"
+ resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
+ integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"