Skip to content

Commit

Permalink
Rearrange some types and prepare for history
Browse files Browse the repository at this point in the history
Related to Issue #39
  • Loading branch information
BobChao87 committed Oct 30, 2021
1 parent 889eefe commit d0b764e
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 31 deletions.
2 changes: 1 addition & 1 deletion components/user/social/Box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<script lang="ts">
import Vue from 'vue';
import { Connection, ConnectionMeta, ConnectionMetas } from '~/types/api/user';
import { Connection, ConnectionMeta, ConnectionMetas } from '~/types/api/connection';
export default Vue.extend({
props: {
Expand Down
26 changes: 26 additions & 0 deletions types/api/connection.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type ConnectionPlatform =
'DISCORD' |
'EMAIL' |
'FACEBOOK' |
'INSTAGRAM' |
'PHONE' |
'NICO' |
'SNAPCHAT' |
'SPEEDRUNCOM' |
'TWITCH' |
'TWITTER';

export interface Connection {
id: number;
platform: ConnectionPlatform;
username: string;
}

export interface ConnectionMeta {
linkBase?: (fragment: string) => string;
icon: Array<String>;
header?: string;
link?: string;
}

export type ConnectionMetas = Record<ConnectionPlatform, ConnectionMeta>;
7 changes: 7 additions & 0 deletions types/api/enums/history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export enum HistoryGameCategoryStatus {
VALIDATED,
BONUS,
BACKUP,
TODO,
REJECTED,
}
34 changes: 34 additions & 0 deletions types/api/history.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { HistoryGameCategoryStatus } from './enums/history';
import { Duration } from './marathon';

export interface History {
games: Array<HistoryGame>;
marathonId: string;
marathonName: string;
marathonStartDate: string|Date;
opponents: Array<any>; // Array<HistoryOpponent>
}

export interface HistoryGame {
categories: Array<HistoryGameCategory>
console: string;
description: string;
emulated: boolean;
id: number;
name: string;
ratio: string;
submission: any; // HistoryGameSubmission
}

export interface HistoryGameCategory {
code: string|null;
description: string;
estimate: Duration;
id: number;
name: string;
opponentDtos: Array<any>|null; // Array<OpponentCategoryDto>|null
opponents: Array<any>; // Array<Opponent>
status: keyof typeof HistoryGameCategoryStatus;
type: string;
video: string;
}
33 changes: 3 additions & 30 deletions types/api/user.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Connection } from './connection';
import { History } from './history';
import { OengusState } from '~/plugins/oengus';

export interface User {
Expand All @@ -6,7 +8,7 @@ export interface User {
country: string|null;
discordName: string;
enabled: boolean;
history: Array<any>; // Array<Horribly Nested User History... Thing>
history: Array<History>; // Array<Horribly Nested User History... Thing>
id: number;
languagesSpoken: Array<string>;
moderatedMarathons: Array<any>; // What are these?
Expand All @@ -32,32 +34,3 @@ export interface UserState extends OengusState {
exists: { [username: string]: UserExists; };
searches: { [query: string]: Array<User>; };
}

// This ended up being kinda social. Move to its own file?

export type ConnectionPlatform =
'DISCORD' |
'EMAIL' |
'FACEBOOK' |
'INSTAGRAM' |
'PHONE' |
'NICO' |
'SNAPCHAT' |
'SPEEDRUNCOM' |
'TWITCH' |
'TWITTER';

export interface Connection {
id: number;
platform: ConnectionPlatform;
username: string;
}

export interface ConnectionMeta {
linkBase?: (fragment: string) => string;
icon: Array<String>;
header?: string;
link?: string;
}

export type ConnectionMetas = Record<ConnectionPlatform, ConnectionMeta>;

0 comments on commit d0b764e

Please sign in to comment.