Skip to content

Commit

Permalink
Fix await when creating formats and categories
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse committed Oct 14, 2024
1 parent 5c9a780 commit 1521102
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions functions/src/api/dao/eventDao.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import firebase, { firestore } from 'firebase-admin'
import firebase from 'firebase-admin'
import { Category, Event, Format, Track } from '../../types'
import FieldValue = firestore.FieldValue

const { FieldValue } = firebase.firestore
import { randomColor } from '../other/randomColor'

export class EventDao {
Expand All @@ -22,7 +23,8 @@ export class EventDao {
): Promise<any> {
const db = firebaseApp.firestore()

db.collection(`events`)
return await db
.collection(`events`)
.doc(eventId)
.update({
categories: FieldValue.arrayUnion({
Expand All @@ -40,7 +42,8 @@ export class EventDao {
public static async createTrack(firebaseApp: firebase.app.App, eventId: string, track: Track): Promise<any> {
const db = firebaseApp.firestore()

db.collection(`events`)
return await db
.collection(`events`)
.doc(eventId)
.update({
tracks: FieldValue.arrayUnion({
Expand All @@ -56,7 +59,8 @@ export class EventDao {
public static async createFormat(firebaseApp: firebase.app.App, eventId: string, format: Format): Promise<any> {
const db = firebaseApp.firestore()

db.collection(`events`)
return await db
.collection(`events`)
.doc(eventId)
.update({
formats: FieldValue.arrayUnion({
Expand Down

0 comments on commit 1521102

Please sign in to comment.