Archived
Add plugin
This commit is contained in:
1 parent
2053c12eee
commit
58fac72355
5 files changed
+128
No files matched your search
@@ -0,0 +1,27 @@
|
||||
export class User {
|
||||
constructor (gamesStarted) {
|
||||
this.gamesStarted = []
|
||||
|
||||
gamesStarted.forEach(e => {
|
||||
this.gamesStarted.push({ course: e.kurs, game: e.spiel })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Firestore data converter
|
||||
export const UserConverter = {
|
||||
toFirestore: (user) => {
|
||||
const spieleBegonnen = []
|
||||
user.gamesStarted.forEach(e => {
|
||||
spieleBegonnen.push({ kurs: e.course, spiel: e.game })
|
||||
})
|
||||
|
||||
return {
|
||||
spieleBegonnen
|
||||
}
|
||||
},
|
||||
fromFirestore: (snapshot, options) => {
|
||||
const data = snapshot.data(options)
|
||||
return new User(data.spieleBegonnen)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user