-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as functions from "firebase-functions"; | ||
import * as admin from "firebase-admin"; | ||
import * as logger from "firebase-functions/logger"; | ||
import { Timestamp } from "firebase-admin/firestore"; | ||
|
||
const firebaseFirestore = admin.firestore(); | ||
|
||
export const createTodo_v0 = functions.https.onCall( | ||
async (data, context) => { | ||
if (!context.auth) { | ||
throw new functions.https.HttpsError( | ||
"failed-precondition", | ||
"The function must be called " + "while authenticated." | ||
); | ||
} | ||
|
||
const userId: string = data.uid; | ||
if (!(typeof userId === "string") || userId.length === 0) { | ||
throw new functions.https.HttpsError( | ||
"invalid-argument", | ||
"The function must be called with " + | ||
"argument \"uid\" containing the user id", | ||
); | ||
} | ||
|
||
const userDocRef = firebaseFirestore.collection('todos').doc(userId).collection('todos') | ||
|
||
userDocRef.get() | ||
final todosInRemote = await _getTodosAsFuture(); | ||
|
||
final todosToSyncJson = <Map<String, dynamic>>[ | ||
...todosInRemote.map((e) => e.toJson()), | ||
todo.toJson(), | ||
]; | ||
|
||
await docRef.set({'todos': todosToSyncJson}); | ||
|
||
final docRef = _queuesRef.doc(_userId) | ||
|
||
final queuesInRemote = await getQueues(); | ||
|
||
final queueToSyncJson = [ | ||
...queuesInRemote.map((e) => e.toJson()), | ||
queue.toJson(), | ||
]; | ||
|
||
await docRef.set({'queues': queueToSyncJson}); | ||
|
||
|
||
} | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
include: package:very_good_analysis/analysis_options.5.0.0.yaml | ||
include: package:very_good_analysis/analysis_options.5.1.0.yaml | ||
linter: | ||
rules: | ||
public_member_api_docs: false |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.