Make various ID related types in Typescript consistently named

This commit is contained in:
Eric Schultz 2021-02-10 16:04:05 -06:00 committed by Eric Schultz
parent c676e70a49
commit 8ee309c1f2
18 changed files with 60 additions and 60 deletions

View file

@ -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<RecurringGiftOptionAmount | OneTimeGiftOptionAmount>;
hide_contributions: boolean;
name: string;
nonprofit: IdType | Nonprofit;
nonprofit: IDType | Nonprofit;
object: "campaign_gift_option";
order: number;
quantity?: number;

View file

@ -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";
}

View file

@ -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';
}

View file

@ -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>;

View file

@ -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<HouID> {
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;
}

View file

@ -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;

View file

@ -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<HouID> {
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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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>;

View file

@ -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<HouID> {
amount: Amount;
nonprofit: IdType | Nonprofit;
nonprofit: IDType | Nonprofit;
object: 'transaction';
payment_methods: Array<unknown>;
payments: Array<unknown>;
status: string;
supporter: IdType | Supporter;
supporter: IDType | Supporter;
transaction_assignments: Array<unknown>;
}

View file

@ -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>;

View file

@ -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';
}

View file

@ -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<HouID> {
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;
}

View file

@ -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<HouID> {
amount: Amount;
nonprofit: IdType | Nonprofit;
nonprofit: IDType | Nonprofit;
object: 'payment';
supporter: IdType | Supporter;
supporter: IDType | Supporter;
transaction: HouID | Transaction;
}

View file

@ -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<HouID> {
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
*/

View file

@ -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';

View file

@ -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<Id extends IdType|HouID=IdType> {
export interface HoudiniObject<ID extends IDType|HouID=IDType> {
/**
* 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<Id extends IdType|HouID=IdType> {
}
type HoudiniObjectOfAllIds = HoudiniObject<IdType> | HoudiniObject<HouID>;
type HoudiniObjectOfAllIDs = HoudiniObject<IDType> | HoudiniObject<HouID>;
/**
* An event published by Houdini
*
@ -83,7 +83,7 @@ type HoudiniObjectOfAllIds = HoudiniObject<IdType> | HoudiniObject<HouID>;
* * 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<EventType extends string, DataObject extends HoudiniObjectOfAllIds> {
export interface HoudiniEvent<EventType extends string, DataObject extends HoudiniObjectOfAllIDs> {
/** 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 */