Class Appointment

Represents an appointment (event) of a calendar.

Table: idea_appointments.

Indexes:

  • calendarId-startTime-index (LSI, all)
  • calendarId-masterAppointmentId-index (LSI, keys); to manage occurences
  • internalNotificationFiresOn-internalNotificationFiresAt-index (GSI); includes: internalNotificationProject, internalNotificationTeamId, internalNotificationUserId, notifications, title, startTime, endTime

Hierarchy (view full)

Constructors

  • Object initialization, setting all the default values.

    Parameters

    • OptionalnewData: any

      the data to load, optional

    • Optionaloptions: any

      custom options to apply; they will depend on the child resource

      Usually, there is no need to implement the constructor; implicitly, it will call the load of the child resource and therefore loading all the resources with default values. If needed, this is the suggested implementation:

      super();
      this.load(x);
      // ...

    Returns Appointment

Properties

allDay: boolean

If true, it's an all-day event.

appointmentId: string

The id of the appointment. In case of external calendar, it's the external id; otherwise (local calendars), it's a IUID.

attendees: AppointmentAttendee[]

The attendees supposed to partecipate to the event. It's an empty array in case the appointment is "private", i.e. the creator is the only attendee.

calendarId: string

The id of the calendar owning the appointment. For external calendars, it's the direct id of the external calendar (and not the id of idea_calendars), to avoid repetitions of appointments for each copy of the external calendar linked to an IDEA calendar.

description: string

The description of the appointment.

endTime: number

The ending time of the appointment.

iCalUID: string

A unique id for the appointment, shared across different calendars and calendaring systems (standard RFC5545); i.e. each appointment in different calendars may have different appointmentId, but it always have same iCalUID. Note: in many calendaring systems recurring events share the same iCalUID.

internalNotificationFiresAt?: number

Fine grain time of alert, expressed in minutes. In case of appointments on external calendars these will not be valued.

internalNotificationFiresOn?: string

Date and hour in which the reminder is slotted (YYYYMMDDHH). Avoid timezones: UTC!! Used to quickly identify the reminders to manage in a particular time frame. In case of appointments on external calendars these will not be valued.

internalNotificationProject?: string

Project from which the notification comes; useful to get the notification preferences. In case of appointments on external calendars these will not be valued.

internalNotificationTeamId?: string

Team of the user that need to be notified; useful to get the notification preferences. In case of appointments on external calendars these will not be valued.

internalNotificationUserId?: string

User that need to be notified; useful to get the notification preferences. In case of appointments on external calendars these will not be valued.

linkToOrigin?: string

In case the calendar is linked to external services, the link to access the external resource.

A list of objects linked to the appointment.

location: string

The location of the appointment.

masterAppointmentId?: string

Master appointment id (optional): the id of the master appointment, in case this is an occurence.

notifications: AppointmentNotification[]

The appointment notifications and the specs for their execution. These may come from external calendars: in that case no internal notifications will fire. Note on notifications from external services. - Microsoft: up to 1 notification, max 1 week before; - Google: up to 5 notifications; max 4 weeks before; - Multiple notifications at the same time are not allowed.

startTime: number

The starting time of the appointment.

timezone: string

The timezone for the appointent start and end.

title: string

The title of the appointment.

Methods

  • Calculate the firing time for internal appointments.

    Returns void

  • Return an attribute in a cleaned standard that force-cast the element.

    Parameters

    • origin: any

      the origin attribute, to cast

    • castFunction: ((x: any) => any)

      the cast function, e.g. Boolean, Number, String, x => new CustomClass(x), etc.

        • (x): any
        • Parameters

          • x: any

          Returns any

    • OptionaldefaultVal: any

      if set, the fallback value instead of null

    Returns any

    cleaned attribute

  • Return an array in a cleaned standard that force-cast each element, keeping only the valid ones.

    Parameters

    • origin: any[]

      the origin array, to cast and check

    • castFunction: ((x: any) => any)

      the cast function, e.g. x => String(x) or x => new CustomClass(x)

        • (x): any
        • Parameters

          • x: any

          Returns any

    • OptionaldefaultVal: any

      if set, the fallback value instead of null

    Returns any[]

    cleaned array

  • Set a default start/end day for all-day events, to be compatible with external services.

    Returns void

  • Whether the user is the organizer of the event. The user can be identified by email or, by default, as the attendee marked as self.

    Parameters

    • Optionalemail: string

    Returns boolean

  • Helper to remove duplicates notifications for the same appointment.

    Returns void

  • Load the attributes from an already existing resource and then force some attributes to assume safeData values. The function is usually used in the back-end to mix together db data with new data, without the risk of changing ids and other attributes which are managed in appositely curated scenario.

    Parameters

    • newData: any

      the data to load

    • safeData: any

      the attributes to force to specific values

    Returns void

  • Valide the object's attributes, performing all the checkings.

    Returns string[]

    errors if empty, the checkings are successfully passed.

    Typical implementation:

    const e = super.validate();
    if(this.iE(this.attr)) e.push(`attr`);
    // ...
    return e;