Skip to content

Commit

Permalink
Add comments I meant to add in #1528 (#1529)
Browse files Browse the repository at this point in the history
Tessa merged #1528 before I got to add these comments lol (it's my
fault, should have left the PR as draft until I was actually ready)
  • Loading branch information
emma-sg authored Feb 13, 2024
1 parent d88a6eb commit 3ed10ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
26 changes: 6 additions & 20 deletions frontend/src/types/org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const AccessCode: Record<UserRole, number> = {
owner: 40,
} as const;

/** `${4-digit year}-${2-digit month}` */
export type YearMonth = `${number}-${Range<0, 2>}${Range<0, 10>}`;

export type OrgData = {
Expand All @@ -18,26 +19,11 @@ export type OrgData = {
slug: string;
quotas?: Record<string, number>;
bytesStored: number;
usage: {
// Keyed by {4-digit year}-{2-digit month}
[key: YearMonth]: number;
} | null;
crawlExecSeconds?: {
// Keyed by {4-digit year}-{2-digit month}
[key: YearMonth]: number;
};
monthlyExecSeconds?: {
// Keyed by {4-digit year}-{2-digit month}
[key: YearMonth]: number;
};
extraExecSeconds?: {
// Keyed by {4-digit year}-{2-digit month}
[key: YearMonth]: number;
};
giftedExecSeconds?: {
// Keyed by {4-digit year}-{2-digit month}
[key: YearMonth]: number;
};
usage: { [key: YearMonth]: number } | null;
crawlExecSeconds?: { [key: YearMonth]: number };
monthlyExecSeconds?: { [key: YearMonth]: number };
extraExecSeconds?: { [key: YearMonth]: number };
giftedExecSeconds?: { [key: YearMonth]: number };
extraExecSecondsAvailable: number;
giftedExecSecondsAvailable: number;
storageQuotaReached?: boolean;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Enumerate<
? Acc[number]
: Enumerate<N, [...Acc, Acc["length"]]>;

/** Number literal range from `F` to `T` (exclusive) */
export type Range<F extends number, T extends number> = Exclude<
Enumerate<T>,
Enumerate<F>
Expand Down

0 comments on commit 3ed10ad

Please sign in to comment.