From 8ee309c1f20418fba2e8d9b08462a8215d385c17 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 10 Feb 2021 16:04:05 -0600 Subject: [PATCH] Make various ID related types in Typescript consistently named --- .../Nonprofit/Campaign/CampaignGiftOption.ts | 6 +++--- docs/event_definitions/Nonprofit/Campaign/index.ts | 4 ++-- .../Nonprofit/CustomFieldDefinition.ts | 4 ++-- .../Nonprofit/Event/EventDiscount.ts | 8 ++++---- docs/event_definitions/Nonprofit/Event/Ticket.ts | 10 +++++----- .../event_definitions/Nonprofit/Event/TicketLevel.ts | 8 ++++---- .../Nonprofit/Event/TicketPurchase.ts | 10 +++++----- docs/event_definitions/Nonprofit/Event/index.ts | 4 ++-- .../Nonprofit/Supporter/SupporterAddress.ts | 6 +++--- .../Nonprofit/Supporter/SupporterNote.ts | 8 ++++---- .../Nonprofit/Supporter/Transaction.ts | 6 +++--- docs/event_definitions/Nonprofit/Supporter/index.ts | 8 ++++---- docs/event_definitions/Nonprofit/TagDefinition.ts | 4 ++-- .../Nonprofit/Transaction/Donation.ts | 6 +++--- .../Nonprofit/Transaction/Payment.ts | 6 +++--- .../event_definitions/Nonprofit/Transaction/index.ts | 8 ++++---- docs/event_definitions/User.ts | 2 +- docs/event_definitions/common.ts | 12 ++++++------ 18 files changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/event_definitions/Nonprofit/Campaign/CampaignGiftOption.ts b/docs/event_definitions/Nonprofit/Campaign/CampaignGiftOption.ts index 5271f650..09193cfd 100644 --- a/docs/event_definitions/Nonprofit/Campaign/CampaignGiftOption.ts +++ b/docs/event_definitions/Nonprofit/Campaign/CampaignGiftOption.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { IdType, HoudiniObject, HoudiniEvent, Amount, RecurrenceRule } from '../../common'; +import type { IDType, HoudiniObject, HoudiniEvent, Amount, RecurrenceRule } from '../../common'; import type Nonprofit from '..'; import type Campaign from '.'; @@ -13,13 +13,13 @@ interface RecurringGiftOptionAmount { } export interface CampaignGiftOption extends HoudiniObject { - campaign: IdType | Campaign; + campaign: IDType | Campaign; deleted: boolean; description: string; gift_option_amount: Array; hide_contributions: boolean; name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "campaign_gift_option"; order: number; quantity?: number; diff --git a/docs/event_definitions/Nonprofit/Campaign/index.ts b/docs/event_definitions/Nonprofit/Campaign/index.ts index 57654766..0a902e29 100644 --- a/docs/event_definitions/Nonprofit/Campaign/index.ts +++ b/docs/event_definitions/Nonprofit/Campaign/index.ts @@ -1,10 +1,10 @@ // License: LGPL-3.0-or-later -import { IdType, HoudiniObject } from '../../common'; +import { IDType, HoudiniObject } from '../../common'; import Nonprofit from '../'; export default interface Campaign extends HoudiniObject { name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "campaign"; } diff --git a/docs/event_definitions/Nonprofit/CustomFieldDefinition.ts b/docs/event_definitions/Nonprofit/CustomFieldDefinition.ts index bb8e62fd..0ebd13ab 100644 --- a/docs/event_definitions/Nonprofit/CustomFieldDefinition.ts +++ b/docs/event_definitions/Nonprofit/CustomFieldDefinition.ts @@ -1,12 +1,12 @@ // License: LGPL-3.0-or-later -import type { HoudiniEvent, HoudiniObject, IdType } from "../common"; +import type { HoudiniEvent, HoudiniObject, IDType } from "../common"; import type Nonprofit from '.'; export interface CustomFieldDefinition extends HoudiniObject { deleted: boolean; name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'custom_field_definition'; } diff --git a/docs/event_definitions/Nonprofit/Event/EventDiscount.ts b/docs/event_definitions/Nonprofit/Event/EventDiscount.ts index a2d19358..1f52735b 100644 --- a/docs/event_definitions/Nonprofit/Event/EventDiscount.ts +++ b/docs/event_definitions/Nonprofit/Event/EventDiscount.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { IdType, HoudiniObject, Amount, HoudiniEvent } from '../../common'; +import type { IDType, HoudiniObject, Amount, HoudiniEvent } from '../../common'; import type Nonprofit from '..'; import type Event from '.'; import type { TicketLevel } from './TicketLevel'; @@ -12,10 +12,10 @@ type DiscountType = { percent: number } | { amount: Amount }; export interface EventDiscount extends HoudiniObject { code: string; discount: DiscountType; - event: IdType | Event; - nonprofit: IdType | Nonprofit; + event: IDType | Event; + nonprofit: IDType | Nonprofit; object: "event_discount"; - ticket_levels: IdType[] | TicketLevel[]; + ticket_levels: IDType[] | TicketLevel[]; } export type EventDiscountCreated = HoudiniEvent<'event_discount.created', EventDiscount>; diff --git a/docs/event_definitions/Nonprofit/Event/Ticket.ts b/docs/event_definitions/Nonprofit/Event/Ticket.ts index d266ae41..1916b5d1 100644 --- a/docs/event_definitions/Nonprofit/Event/Ticket.ts +++ b/docs/event_definitions/Nonprofit/Event/Ticket.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { HouID, HoudiniObject, HoudiniEvent, Amount, IdType} from '../../common'; +import type { HouID, HoudiniObject, HoudiniEvent, Amount, IDType} from '../../common'; import type Nonprofit from '..'; import type Event from '.'; import type { TicketLevel , TicketPurchase} from '.'; @@ -9,12 +9,12 @@ export interface Ticket extends HoudiniObject { amount: Amount; checked_in: boolean; deleted: boolean; - event: IdType | Event; - nonprofit: IdType | Nonprofit; + event: IDType | Event; + nonprofit: IDType | Nonprofit; note: string; object: 'ticket'; - supporter: IdType | Supporter; - ticket_level: IdType | TicketLevel; + supporter: IDType | Supporter; + ticket_level: IDType | TicketLevel; ticket_purchase: HouID | TicketPurchase; } diff --git a/docs/event_definitions/Nonprofit/Event/TicketLevel.ts b/docs/event_definitions/Nonprofit/Event/TicketLevel.ts index 6c457c86..31826e10 100644 --- a/docs/event_definitions/Nonprofit/Event/TicketLevel.ts +++ b/docs/event_definitions/Nonprofit/Event/TicketLevel.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import { IdType, HoudiniObject, HoudiniEvent, Amount } from '../../common'; +import { IDType, HoudiniObject, HoudiniEvent, Amount } from '../../common'; import Nonprofit from '..'; import Event from './'; import { EventDiscount } from './EventDiscount'; @@ -17,12 +17,12 @@ export interface TicketLevel extends HoudiniObject { available_to: 'everyone' | 'admins'; deleted: boolean; description: string; - event: IdType | Event; + event: IDType | Event; /** * at some time, event discounts will be associated with a given ticket level. * For now, this returns all of the discounts for the event though. */ - event_discounts: IdType[] | EventDiscount[]; + event_discounts: IDType[] | EventDiscount[]; /** * the max number of tickets to be sold on this TicketLevel, null means unlimited. * If you edit this and decide to lower the limit below the number of tickets currently sold, @@ -33,7 +33,7 @@ export interface TicketLevel extends HoudiniObject { * Nice readable name fo the ticket level */ name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "ticket_level"; /** order to be displayed */ order: number; diff --git a/docs/event_definitions/Nonprofit/Event/TicketPurchase.ts b/docs/event_definitions/Nonprofit/Event/TicketPurchase.ts index 6d71dc1e..df847e8e 100644 --- a/docs/event_definitions/Nonprofit/Event/TicketPurchase.ts +++ b/docs/event_definitions/Nonprofit/Event/TicketPurchase.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { HouID, HoudiniObject, HoudiniEvent, Amount, IdType} from '../../common'; +import type { HouID, HoudiniObject, HoudiniEvent, Amount, IDType} from '../../common'; import type Nonprofit from '..'; import type Event from '.'; import type { EventDiscount, Ticket } from '.'; @@ -9,11 +9,11 @@ import { Transaction } from '../Supporter'; export interface TicketPurchase extends HoudiniObject { amount: Amount; - event: IdType | Event; - event_discount?: IdType | EventDiscount | null; - nonprofit: IdType | Nonprofit; + event: IDType | Event; + event_discount?: IDType | EventDiscount | null; + nonprofit: IDType | Nonprofit; object: 'ticket_purchase'; - supporter: IdType | Supporter; + supporter: IDType | Supporter; tickets: Ticket[] | HouID[]; transaction: HouID | Transaction; } diff --git a/docs/event_definitions/Nonprofit/Event/index.ts b/docs/event_definitions/Nonprofit/Event/index.ts index d19ef08d..b8edbc2f 100644 --- a/docs/event_definitions/Nonprofit/Event/index.ts +++ b/docs/event_definitions/Nonprofit/Event/index.ts @@ -1,11 +1,11 @@ // License: LGPL-3.0-or-later -import { IdType, HoudiniObject } from '../../common'; +import { IDType, HoudiniObject } from '../../common'; import Nonprofit from '../'; export default interface Event extends HoudiniObject { end_date: Date; name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "event"; start_date: Date; } diff --git a/docs/event_definitions/Nonprofit/Supporter/SupporterAddress.ts b/docs/event_definitions/Nonprofit/Supporter/SupporterAddress.ts index 92e2469f..84e9965b 100644 --- a/docs/event_definitions/Nonprofit/Supporter/SupporterAddress.ts +++ b/docs/event_definitions/Nonprofit/Supporter/SupporterAddress.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { IdType, HoudiniObject, HoudiniEvent } from '../../common'; +import type { IDType, HoudiniObject, HoudiniEvent } from '../../common'; import type Nonprofit from '..'; import type Supporter from '.'; @@ -8,10 +8,10 @@ export interface SupporterAddress extends HoudiniObject { city: string; country: string; deleted: boolean; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "supporter_address"; state_code: string; - supporter: IdType | Supporter; + supporter: IDType | Supporter; zip_code: string; } diff --git a/docs/event_definitions/Nonprofit/Supporter/SupporterNote.ts b/docs/event_definitions/Nonprofit/Supporter/SupporterNote.ts index 39a2b1e8..137143a5 100644 --- a/docs/event_definitions/Nonprofit/Supporter/SupporterNote.ts +++ b/docs/event_definitions/Nonprofit/Supporter/SupporterNote.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { IdType, HoudiniObject, HoudiniEvent } from '../../common'; +import type { IDType, HoudiniObject, HoudiniEvent } from '../../common'; import type Nonprofit from '..'; import Supporter from '.'; import type { User } from '../../User'; @@ -7,10 +7,10 @@ import type { User } from '../../User'; export interface SupporterNote extends HoudiniObject { content: string; deleted: boolean; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "supporter_note"; - supporter: IdType | Supporter; - user: IdType | User; + supporter: IDType | Supporter; + user: IDType | User; } export type SupporterNoteCreated = HoudiniEvent<'supporter_note.created', SupporterNote>; diff --git a/docs/event_definitions/Nonprofit/Supporter/Transaction.ts b/docs/event_definitions/Nonprofit/Supporter/Transaction.ts index ea1b6e1a..601be86f 100644 --- a/docs/event_definitions/Nonprofit/Supporter/Transaction.ts +++ b/docs/event_definitions/Nonprofit/Supporter/Transaction.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { Amount, HoudiniObject, IdType, HouID } from "../../common"; +import type { Amount, HoudiniObject, IDType, HouID } from "../../common"; import type Nonprofit from '..'; import type Supporter from "."; @@ -8,11 +8,11 @@ import type Supporter from "."; */ export interface Transaction extends HoudiniObject { amount: Amount; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'transaction'; payment_methods: Array; payments: Array; status: string; - supporter: IdType | Supporter; + supporter: IDType | Supporter; transaction_assignments: Array; } diff --git a/docs/event_definitions/Nonprofit/Supporter/index.ts b/docs/event_definitions/Nonprofit/Supporter/index.ts index 6ca2b1c7..638870ca 100644 --- a/docs/event_definitions/Nonprofit/Supporter/index.ts +++ b/docs/event_definitions/Nonprofit/Supporter/index.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { IdType, HoudiniObject, HoudiniEvent } from '../../common'; +import type { IDType, HoudiniObject, HoudiniEvent } from '../../common'; import type Nonprofit from '../'; import type { SupporterAddress } from './SupporterAddress'; @@ -7,13 +7,13 @@ export default interface Supporter extends HoudiniObject { anonymous: boolean; deleted: boolean; email: string; - merged_into: IdType | Supporter | null; + merged_into: IDType | Supporter | null; name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: "supporter"; organization: string; phone: string; - supporter_addresses: IdType[] | SupporterAddress[]; + supporter_addresses: IDType[] | SupporterAddress[]; } export type SupporterCreated = HoudiniEvent<'supporter_address.created', Supporter>; diff --git a/docs/event_definitions/Nonprofit/TagDefinition.ts b/docs/event_definitions/Nonprofit/TagDefinition.ts index 5706db41..3ce5cfcf 100644 --- a/docs/event_definitions/Nonprofit/TagDefinition.ts +++ b/docs/event_definitions/Nonprofit/TagDefinition.ts @@ -1,12 +1,12 @@ // License: LGPL-3.0-or-later -import type { HoudiniEvent, HoudiniObject, IdType } from "../common"; +import type { HoudiniEvent, HoudiniObject, IDType } from "../common"; import type Nonprofit from './'; export interface TagDefinition extends HoudiniObject { deleted: boolean; name: string; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'tag_definition'; } diff --git a/docs/event_definitions/Nonprofit/Transaction/Donation.ts b/docs/event_definitions/Nonprofit/Transaction/Donation.ts index be58bfc5..a7ed5850 100644 --- a/docs/event_definitions/Nonprofit/Transaction/Donation.ts +++ b/docs/event_definitions/Nonprofit/Transaction/Donation.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { Amount, HoudiniObject, IdType, HouID, HoudiniEvent } from "../../common"; +import type { Amount, HoudiniObject, IDType, HouID, HoudiniEvent } from "../../common"; import type Nonprofit from '../'; import type Supporter from "../Supporter"; import type Transaction from './'; @@ -19,9 +19,9 @@ export interface Donation extends HoudiniObject { amount: Amount; dedication?: Dedication | null; designation?: string | null; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'donation'; - supporter: IdType | Supporter; + supporter: IDType | Supporter; transaction: HouID | Transaction; } diff --git a/docs/event_definitions/Nonprofit/Transaction/Payment.ts b/docs/event_definitions/Nonprofit/Transaction/Payment.ts index 49489c96..7281340e 100644 --- a/docs/event_definitions/Nonprofit/Transaction/Payment.ts +++ b/docs/event_definitions/Nonprofit/Transaction/Payment.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import type { Amount, HoudiniObject, IdType, HouID } from "../../common"; +import type { Amount, HoudiniObject, IDType, HouID } from "../../common"; import type Nonprofit from '../'; import type Supporter from "../Supporter"; import type Transaction from './'; @@ -7,9 +7,9 @@ import type Transaction from './'; export interface Payment extends HoudiniObject { amount: Amount; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'payment'; - supporter: IdType | Supporter; + supporter: IDType | Supporter; transaction: HouID | Transaction; } diff --git a/docs/event_definitions/Nonprofit/Transaction/index.ts b/docs/event_definitions/Nonprofit/Transaction/index.ts index 824e449d..48cd8644 100644 --- a/docs/event_definitions/Nonprofit/Transaction/index.ts +++ b/docs/event_definitions/Nonprofit/Transaction/index.ts @@ -1,16 +1,16 @@ // License: LGPL-3.0-or-later -import type { Amount, HoudiniObject, IdType, HouID } from "../../common"; +import type { Amount, HoudiniObject, IDType, HouID } from "../../common"; import type Nonprofit from '../'; import type Supporter from "../Supporter"; import type { Payment } from "./Payment"; export default interface Transaction extends HoudiniObject { amount: Amount; - nonprofit: IdType | Nonprofit; + nonprofit: IDType | Nonprofit; object: 'transaction'; - payments: IdType[] | Payment[]; + payments: IDType[] | Payment[]; status: "not-submitted"|"created" | "waiting-on-supporter" | "failed" | "completed"; - supporter: IdType | Supporter; + supporter: IDType | Supporter; /** * We don't specify more for now */ diff --git a/docs/event_definitions/User.ts b/docs/event_definitions/User.ts index 423b5831..cf0b335a 100644 --- a/docs/event_definitions/User.ts +++ b/docs/event_definitions/User.ts @@ -1,5 +1,5 @@ // License: LGPL-3.0-or-later -import { IdType, HoudiniObject } from './common'; +import { IDType, HoudiniObject } from './common'; export interface User extends HoudiniObject { object: 'user'; diff --git a/docs/event_definitions/common.ts b/docs/event_definitions/common.ts index 11b19a22..dd8e0da8 100644 --- a/docs/event_definitions/common.ts +++ b/docs/event_definitions/common.ts @@ -4,7 +4,7 @@ * the main identifier for HoudiniObjects which is unique between all other HoudiniObjects with the same object value. * Currently just an integer but we could reevaluate later; */ -export type IdType = number; +export type IDType = number; /** * an identifier for HoudiniObjects which is unique among all HoudiniObjects. @@ -60,12 +60,12 @@ export type RecurrenceRule = { * Every object controlled by the Houdini event publisher must meet this standard interface * and will inherit from it. */ -export interface HoudiniObject { +export interface HoudiniObject { /** - * An IdType which unique which uniquely identifies this object + * An IDType which unique which uniquely identifies this object * from all other similar objects */ - id: Id; + id: ID; /** * the type of object. Roughly corresponds to the object's class in Rails */ @@ -73,7 +73,7 @@ export interface HoudiniObject { } -type HoudiniObjectOfAllIds = HoudiniObject | HoudiniObject; +type HoudiniObjectOfAllIDs = HoudiniObject | HoudiniObject; /** * An event published by Houdini * @@ -83,7 +83,7 @@ type HoudiniObjectOfAllIds = HoudiniObject | HoudiniObject; * * DataObject: the interface representing the actual object which the event occurred on. An object of that type is * on the 'data' attribute */ -export interface HoudiniEvent { +export interface HoudiniEvent { /** data for the event. We wrap the object inside becuase we might want to provide some sort of */ data: { /** the object after the event has occurred */