From 2562bd275740b49307375c6013e590fb5e9c28f9 Mon Sep 17 00:00:00 2001 From: Jeremy Sabat Date: Tue, 7 May 2024 08:03:34 -0700 Subject: [PATCH] =?UTF-8?q?fix(hub-common):=20add=20IAssociation,=20update?= =?UTF-8?q?=20IEvent=20with=20associations,=20a=E2=80=A6=20(#1498)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/events/api/orval/api/orval-events.ts | 307 ++++++++++-------- packages/common/src/events/api/types.ts | 3 + 2 files changed, 174 insertions(+), 136 deletions(-) diff --git a/packages/common/src/events/api/orval/api/orval-events.ts b/packages/common/src/events/api/orval/api/orval-events.ts index 5cb7210f55e..a71bfbd1013 100644 --- a/packages/common/src/events/api/orval/api/orval-events.ts +++ b/packages/common/src/events/api/orval/api/orval-events.ts @@ -7,19 +7,6 @@ */ import { Awaited } from "../awaited-type"; import { customClient } from "../custom-client"; -export interface IPagedRegistrationResponse { - items: IRegistration[]; - nextStart: number; - total: number; -} - -export enum RegistrationSort { - createdAt = "createdAt", - updatedAt = "updatedAt", - firstName = "firstName", - lastName = "lastName", - username = "username", -} export type GetRegistrationsParams = { /** * Event id being registered for @@ -49,6 +36,10 @@ export type GetRegistrationsParams = { * earliest ISO8601 updatedAt for the registrations */ updatedAtAfter?: string; + /** + * filter to be matched to firstName, lastName, or username + */ + name?: string; /** * the max amount of registrations to return */ @@ -67,6 +58,91 @@ export type GetRegistrationsParams = { sortOrder?: SortOrder; }; +export type GetEventsParams = { + /** + * Comma separated string list of EventAccess + */ + access?: string; + /** + * Comma separated string list of associated entityIds + */ + entityIds?: string; + /** + * Comma separated string list of associated entity types + */ + entityTypes?: string; + /** + * Comma separated string list of relation fields to include in response + */ + include?: string; + /** + * latest ISO8601 start date-time for the events + */ + startDateTimeBefore?: string; + /** + * earliest ISO8601 start date-time for the events + */ + startDateTimeAfter?: string; + /** + * Comma separated string list of AttendanceTypes + */ + attendanceTypes?: string; + /** + * Comma separated string list of categories + */ + categories?: string; + /** + * comma separated string list of event statuses + */ + status?: string; + /** + * Comma separated string list of tags + */ + tags?: string; + /** + * string to match within an event title + */ + title?: string; + /** + * the max amount of events to return + */ + num?: string; + /** + * the index to start at + */ + start?: string; + /** + * Event property to sort results by + */ + sortBy?: EventSort; + /** + * sort results order desc or asc + */ + sortOrder?: SortOrder; +}; + +export interface IUpdateRegistration { + /** Role of the user in the event */ + role?: RegistrationRole; + /** Status of the registration */ + status?: RegistrationStatus; + /** Attendance type for this registration */ + type?: EventAttendanceType; +} + +export interface IPagedRegistrationResponse { + items: IRegistration[]; + nextStart: number; + total: number; +} + +export enum RegistrationSort { + createdAt = "createdAt", + updatedAt = "updatedAt", + firstName = "firstName", + lastName = "lastName", + username = "username", +} export interface ICreateRegistration { /** ArcGIS Online id for a user. Will always be extracted from the token unless service token is used. */ agoId?: string; @@ -100,6 +176,8 @@ export interface IUpdateEvent { allDay?: boolean; /** Boolean to indicate if users can register for an event */ allowRegistration?: boolean; + /** Items associated with the event */ + associations?: ICreateAssociation[]; /** Valid ways to attend the event */ attendanceType?: EventAttendanceType[]; /** categories for the event */ @@ -136,12 +214,6 @@ export interface IUpdateEvent { title?: string; } -export interface IPagedEventResponse { - items: IEvent[]; - nextStart: number; - total: number; -} - export enum SortOrder { asc = "asc", desc = "desc", @@ -152,61 +224,6 @@ export enum EventSort { createdAt = "createdAt", updatedAt = "updatedAt", } -export type GetEventsParams = { - /** - * Comma separated string list of EventAccess - */ - access?: string; - /** - * Comma separated string list of relation fields to include in response - */ - include?: string; - /** - * latest ISO8601 start date-time for the events - */ - startDateTimeBefore?: string; - /** - * earliest ISO8601 start date-time for the events - */ - startDateTimeAfter?: string; - /** - * Comma separated string list of AttendanceTypes - */ - attendanceTypes?: string; - /** - * Comma separated string list of categories - */ - categories?: string; - /** - * comma separated string list of event statuses - */ - status?: string; - /** - * Comma separated string list of tags - */ - tags?: string; - /** - * string to match within an event title - */ - title?: string; - /** - * the max amount of events to return - */ - num?: string; - /** - * the index to start at - */ - start?: string; - /** - * Event property to sort results by - */ - sortBy?: EventSort; - /** - * sort results order desc or asc - */ - sortOrder?: SortOrder; -}; - export interface IRegistrationPermission { canDelete: boolean; canEdit: boolean; @@ -226,11 +243,55 @@ export interface IEventPermission { canSetStatusToRemoved: boolean; } +export enum RegistrationStatus { + PENDING = "PENDING", + ACCEPTED = "ACCEPTED", + DECLINED = "DECLINED", + BLOCKED = "BLOCKED", +} +export enum RegistrationRole { + OWNER = "OWNER", + ORGANIZER = "ORGANIZER", + ATTENDEE = "ATTENDEE", +} +export enum EventStatus { + PLANNED = "PLANNED", + CANCELED = "CANCELED", + REMOVED = "REMOVED", +} +export interface IOnlineMeeting { + capacity: number | null; + createdAt: string; + details: string | null; + eventId: string; + updatedAt: string; + url: string; +} + +export interface IUser { + agoId: string; + createdAt: string; + deleted: boolean; + email: string; + firstName: string; + lastName: string; + optedOut: boolean; + updatedAt: string; + username: string; +} + +export interface IAssociation { + entityId: string; + entityType: AssociationEntityType; + eventId: string; +} + export interface IEvent { access: EventAccess; addresses?: IAddress[]; allDay: boolean; allowRegistration: boolean; + associations?: IAssociation[]; attendanceType: EventAttendanceType[]; catalog: IEventCatalogItem[] | null; categories: string[]; @@ -262,50 +323,10 @@ export interface IEvent { updatedAt: string; } -export enum RegistrationStatus { - PENDING = "PENDING", - ACCEPTED = "ACCEPTED", - DECLINED = "DECLINED", - BLOCKED = "BLOCKED", -} -export enum RegistrationRole { - OWNER = "OWNER", - ORGANIZER = "ORGANIZER", - ATTENDEE = "ATTENDEE", -} -export interface IUpdateRegistration { - /** Role of the user in the event */ - role?: RegistrationRole; - /** Status of the registration */ - status?: RegistrationStatus; - /** Attendance type for this registration */ - type?: EventAttendanceType; -} - -export enum EventStatus { - PLANNED = "PLANNED", - CANCELED = "CANCELED", - REMOVED = "REMOVED", -} -export interface IOnlineMeeting { - capacity: number | null; - createdAt: string; - details: string | null; - eventId: string; - updatedAt: string; - url: string; -} - -export interface IUser { - agoId: string; - createdAt: string; - deleted: boolean; - email: string; - firstName: string; - lastName: string; - optedOut: boolean; - updatedAt: string; - username: string; +export interface IPagedEventResponse { + items: IEvent[]; + nextStart: number; + total: number; } export interface IRegistration { @@ -362,24 +383,6 @@ export enum EventAttendanceType { VIRTUAL = "VIRTUAL", IN_PERSON = "IN_PERSON", } -export enum EventAccess { - PRIVATE = "PRIVATE", - ORG = "ORG", - PUBLIC = "PUBLIC", -} -export interface ICreateAddress { - /** Street address */ - address: string; - /** Secondary address information (room, etc) */ - address2?: string; - /** Capacity of this location. Minimum value is 1 */ - capacity?: number; - /** Description for the address */ - description?: string; - /** Venue information for the address */ - venue?: string; -} - export interface ICreateEvent { /** Access level of the event */ access?: EventAccess; @@ -391,6 +394,8 @@ export interface ICreateEvent { allDay?: boolean; /** Boolean to indicate if users can register for an event */ allowRegistration?: boolean; + /** Items associated with the event */ + associations?: ICreateAssociation[]; /** Valid ways to attend the event */ attendanceType?: EventAttendanceType[]; /** categories for the event */ @@ -433,6 +438,36 @@ export interface ICreateEvent { username?: string; } +export enum AssociationEntityType { + Hub_Site_Application = "Hub Site Application", + Hub_Initiative = "Hub Initiative", + Hub_Project = "Hub Project", +} +export interface ICreateAssociation { + /** Entity Id */ + entityId: string; + /** Entity type */ + entityType: AssociationEntityType; +} + +export enum EventAccess { + PRIVATE = "PRIVATE", + ORG = "ORG", + PUBLIC = "PUBLIC", +} +export interface ICreateAddress { + /** Street address */ + address: string; + /** Secondary address information (room, etc) */ + address2?: string; + /** Capacity of this location. Minimum value is 1 */ + capacity?: number; + /** Description for the address */ + description?: string; + /** Venue information for the address */ + venue?: string; +} + type SecondParameter any> = Parameters[1]; export const createEvent = ( diff --git a/packages/common/src/events/api/types.ts b/packages/common/src/events/api/types.ts index b2981d14115..eb5ebd6dc04 100644 --- a/packages/common/src/events/api/types.ts +++ b/packages/common/src/events/api/types.ts @@ -1,4 +1,5 @@ export { + AssociationEntityType, EventAccess, EventAttendanceType, EventStatus, @@ -6,6 +7,8 @@ export { IAddress, IAddressExtent, IAddressLocation, + IAssociation, + ICreateAssociation, IOnlineMeeting, ICreateOnlineMeeting, ICreateAddress,