Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hub-common): update events types #1426

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 17 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 54 additions & 1 deletion packages/common/src/events/api/orval/api/orval-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export type GetEventsParams = {
* earliest ISO8601 start date-time for the events
*/
startDateTimeAfter?: string;
/**
* Comma separated sting list of AttendanceTypes
*/
attendanceTypes?: string;
/**
* the max amount of events to return
*/
Expand Down Expand Up @@ -51,8 +55,42 @@ export interface ICreateRegistration {
username?: string;
}

/**
* GeoJSON formatted geometry related to the event
*/
export type IUpdateEventGeometry = { [key: string]: any };

export interface IUpdateEvent {
[key: string]: any;
/** Access level of the event */
access?: EventAccess;
/** Addresses for the event */
addresses?: ICreateAddress[];
/** Flag for all day event */
allDay?: boolean;
/** Valid ways to attend the event */
attendanceType?: EventAttendanceType[];
/** Description of the event */
description?: string;
/** Groups with edit access to the event */
editGroups?: string[];
/** ISO8601 end date-time for the event */
endDateTime?: string;
/** GeoJSON formatted geometry related to the event */
geometry?: IUpdateEventGeometry;
/** Flag to notify attendees */
notifyAttendees?: boolean;
/** Online meetings for the event */
onlineMeetings?: ICreateOnlineMeeting[];
/** Groups with read access to the event */
readGroups?: string[];
/** ISO8601 start date-time for the event */
startDateTime?: string;
/** Summary of the event */
summary?: string;
/** IANA time zone for the event */
timeZone?: string;
/** Title of the event */
title?: string;
}

export type IAddressLocation = { [key: string]: any };
Expand Down Expand Up @@ -159,7 +197,13 @@ export enum EventAttendanceType {
VIRTUAL = "VIRTUAL",
IN_PERSON = "IN_PERSON",
}
export enum EventAccess {
PRIVATE = "PRIVATE",
ORG = "ORG",
PUBLIC = "PUBLIC",
}
export interface IEvent {
access: EventAccess;
addresses?: IAddress[];
allDay: boolean;
attendanceType: EventAttendanceType[];
Expand All @@ -168,11 +212,14 @@ export interface IEvent {
createdById: string;
creator?: IUser;
description: string | null;
editGroups: string[] | null;
endDateTime: string;
geometry: IEventGeometry;
id: string;
notifyAttendees: boolean;
onlineMeetings?: IOnlineMeeting[];
orgId: string;
readGroups: string[] | null;
recurrence: string | null;
registrations?: IRegistration[];
startDateTime: string;
Expand All @@ -197,6 +244,8 @@ export interface ICreateAddress {
}

export interface ICreateEvent {
/** Access level of the event */
access?: EventAccess;
/** Addresses for the event. Required if attendanceType includes IN_PERSON */
addresses?: ICreateAddress[];
/** ArcGIS Online id for a user. Will always be extracted from the token unless service token is used. */
Expand All @@ -207,6 +256,8 @@ export interface ICreateEvent {
attendanceType?: EventAttendanceType[];
/** Description of the event */
description?: string;
/** Groups with edit access to the event */
editGroups?: string[];
/** Email for the subscriber. Will always be extracted from the token unless service token is used. */
email?: string;
/** ISO8601 end date-time for the event */
Expand All @@ -221,6 +272,8 @@ export interface ICreateEvent {
notifyAttendees?: boolean;
/** Online meetings for the event. Required if attendanceType includes VIRTUAL */
onlineMeetings?: ICreateOnlineMeeting[];
/** Groups with read access to the event */
readGroups?: string[];
/** ISO8601 start date-time for the event */
startDateTime: string;
/** Summary of the event */
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/events/api/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export {
EventAccess,
EventAttendanceType,
EventStatus,
GetEventsParams,
Expand Down
4 changes: 4 additions & 0 deletions packages/common/test/events/api/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
EventAttendanceType,
EventStatus,
} from "../../../src/events/api";
import { EventAccess } from "../../../src/events/api/types";
import * as authenticateRequestModule from "../../../src/events/api/utils/authenticate-request";
import * as orvalModule from "../../../src/events/api/orval/api/orval-events";

Expand All @@ -36,6 +37,7 @@ describe("Events", () => {

const options: ICreateEventParams = {
data: {
access: EventAccess.ORG,
addresses: [
{
address: "111 Crunchy Street Bend, OR 97703",
Expand All @@ -51,6 +53,7 @@ describe("Events", () => {
EventAttendanceType.VIRTUAL,
],
description: "a description",
editGroups: ["111"],
endDateTime: "2023-12-19T19:52:13.584Z",
geometry: {
type: "Feature",
Expand All @@ -65,6 +68,7 @@ describe("Events", () => {
details: "Tacos online are here",
},
],
readGroups: ["111"],
startDateTime: "2023-12-01T19:52:13.584Z",
summary: "a summary",
timeZone: "America/Los_Angeles",
Expand Down
Loading