Skip to content

Commit

Permalink
refactor(app-general): use firebase enums singular
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodigioacchino committed Jan 15, 2021
1 parent 628949d commit 7a5290a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import firebase from 'firebase/app';
import { DevOpsMaturitiesDoc, FirebaseCollections, FirebaseDocs, GameRolesDoc } from '@pipeline/common';
import { DevOpsMaturitiesDoc, FirebaseCollection, FirebaseDoc, GameRolesDoc } from '@pipeline/common';

import 'firebase/firestore';

export async function executeRetrieveGameRoles(): Promise<GameRolesDoc> {
const gameRolesDoc = await firebase
.firestore()
.doc(`${FirebaseCollections.DynamicData}/${FirebaseDocs.GameRoles}`)
.doc(`${FirebaseCollection.DynamicData}/${FirebaseDoc.GameRoles}`)
.get();
if (!gameRolesDoc.exists) {
//TODO handle this
Expand All @@ -17,7 +17,7 @@ export async function executeRetrieveGameRoles(): Promise<GameRolesDoc> {
export async function executeRetrieveDevOpsMaturities(): Promise<DevOpsMaturitiesDoc> {
const devOpsMaturitiesDoc = await firebase
.firestore()
.doc(`${FirebaseCollections.DynamicData}/${FirebaseDocs.DevOpsMaturities}`)
.doc(`${FirebaseCollection.DynamicData}/${FirebaseDoc.DevOpsMaturities}`)
.get();
if (!devOpsMaturitiesDoc.exists) {
//TODO handle this
Expand Down
4 changes: 2 additions & 2 deletions packages/game-app/src/createGame/apis/callCreateGame.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { GameCreationData } from '../types/gameCreationData';
import firebase from 'firebase/app';
import 'firebase/firestore';
import { FirebaseCollections, Game } from '@pipeline/common';
import { FirebaseCollection, Game } from '@pipeline/common';

const DEFAULT_DECK_ID = '7p5qqvE8kCV9WWysVc2n';

export default function callCreateGame(data: GameCreationData, userId: string): Promise<string> {
return firebase
.firestore()
.collection(FirebaseCollections.Games)
.collection(FirebaseCollection.Games)
.add({
scenarioContent: data.scenarioContent,
scenarioTitle: data.scenarioTitle,
Expand Down
4 changes: 2 additions & 2 deletions packages/game-app/src/gameView/apis/callLoadCards.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import firebase from 'firebase/app';
import 'firebase/firestore';
import { CardEntity, FirebaseCollections } from '@pipeline/common';
import { CardEntity, FirebaseCollection } from '@pipeline/common';

export default async function loadCards(): Promise<CardEntity[]> {
const cards = await firebase.firestore().collection(FirebaseCollections.Cards).get();
const cards = await firebase.firestore().collection(FirebaseCollection.Cards).get();

return cards.docs.map(d => ({ id: d.id, ...d.data() } as CardEntity));
}
4 changes: 2 additions & 2 deletions packages/game-app/src/signup/apis/executeSignup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SignupInfo } from '../types/signupInfo';
import firebase from 'firebase/app';
import { FirebaseCollections } from '@pipeline/common';
import { FirebaseCollection } from '@pipeline/common';
import 'firebase/auth';
import 'firebase/firestore';
import { AuthUser } from '../../_shared/auth/slice';
Expand All @@ -10,7 +10,7 @@ export async function executeSignup(signupInfo: SignupInfo): Promise<AuthUser> {
if (credentials.user) {
const user = credentials.user;
try {
await firebase.firestore().doc(`${FirebaseCollections.Users}/${user?.uid}`).set({
await firebase.firestore().doc(`${FirebaseCollection.Users}/${user?.uid}`).set({
email: signupInfo.email,
role: signupInfo.role,
devOpsMaturity: signupInfo.devOpsMaturity,
Expand Down

0 comments on commit 7a5290a

Please sign in to comment.