Skip to content

Commit

Permalink
feat(common-general): remove firebase dep
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodigioacchino committed Jan 26, 2021
1 parent 2387db0 commit d29bb33
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
1 change: 0 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
"typescript": "4.1.3"
},
"dependencies": {
"firebase": "^8.2.1"
}
}
5 changes: 2 additions & 3 deletions packages/common/src/CreatedAt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fb from "firebase";

export interface CreatedAt {
createdAt: fb.firestore.Timestamp | fb.firestore.FieldValue;
export interface CreatedAt<T, F> {
createdAt: T | F;
}
5 changes: 2 additions & 3 deletions packages/common/src/UpdatedAt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fb from "firebase";

export interface UpdatedAt {
updatedAt: fb.firestore.Timestamp | fb.firestore.FieldValue;
export interface UpdatedAt<T, F> {
updatedAt: T | F;
}
11 changes: 10 additions & 1 deletion packages/common/src/game.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {CreatedAt} from "./CreatedAt";
import {ShortUser} from "./user";

export interface Game extends CreatedAt {
export interface Game<T, F> extends CreatedAt<T, F> {
scenarioTitle: string;
scenarioContent: string;
scenarioCardId: string | null;
Expand All @@ -12,6 +12,15 @@ export interface Game extends CreatedAt {
boardDimensions: {x: number, y: number} | null;
}

export interface RTDBGame<T, F> extends CreatedAt<T, F> {
scenarioTitle: string;
scenarioContent: string;
scenarioCardId: string | null;
deckId: string;
facilitator: ShortUser;
boardDimensions: {x: number, y: number} | null;
}

export interface CardState {
parent: 'board'| 'panel';
position?: {
Expand Down
4 changes: 3 additions & 1 deletion packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {FirebaseDoc} from "./firebaseDoc";
import {DevOpsMaturitiesDoc} from "./devOpsMaturitiesDoc";
import {GameRolesDoc} from "./gameRolesDoc";
import {Card, CardTypes, CardTags, CardEntity} from "./card";
import {Game} from "./game";
import {Game, RTDBGame, CardState} from "./game";
import {ShortUser} from "./user";
import {RTDBInstance} from "./rtdbInstance";
import {Status} from "./status";
Expand All @@ -23,6 +23,8 @@ export type {
CardEntity,
Card,
Game,
RTDBGame,
CardState,
ShortUser,
RTDBInstance,
Status,
Expand Down
4 changes: 1 addition & 3 deletions packages/common/src/rtdbInstance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {CreatedAt} from "./CreatedAt";

export interface RTDBInstance extends CreatedAt {
export interface RTDBInstance {
onlineOnGameCount: number;
region: string;
}
1 change: 1 addition & 0 deletions packages/common/src/rtdbPaths.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum RTDBPaths {
Games = 'games',
Cards = 'cards',
Statuses = 'statuses'
}
4 changes: 2 additions & 2 deletions packages/common/src/status.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {UpdatedAt} from "./UpdatedAt";

export interface Status extends UpdatedAt {
export interface Status<T, F> extends UpdatedAt<T, F> {
state: 'offline' | 'online';
gameId: string | null;
gameIds: {[key: string]: boolean} | null;
}

0 comments on commit d29bb33

Please sign in to comment.