Skip to content

Commit

Permalink
fix(hub-common): add IAssociation, update IEvent with associations, a… (
Browse files Browse the repository at this point in the history
  • Loading branch information
velveetachef authored May 7, 2024
1 parent 11cb724 commit 2562bd2
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 136 deletions.
307 changes: 171 additions & 136 deletions packages/common/src/events/api/orval/api/orval-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
*/
Expand All @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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",
Expand All @@ -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;
Expand All @@ -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[];
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -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<T extends (...args: any) => any> = Parameters<T>[1];

export const createEvent = (
Expand Down
Loading

0 comments on commit 2562bd2

Please sign in to comment.