Skip to content

Commit

Permalink
refactor: setting up for riverpod implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
demolaf committed Nov 29, 2023
1 parent dadfaae commit 637dbe0
Show file tree
Hide file tree
Showing 124 changed files with 819 additions and 832 deletions.
3 changes: 3 additions & 0 deletions backend/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions backend/.idea/backend.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions backend/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions backend/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions backend/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions backend/functions/src/modules/create_todo.ts
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});


}
);
6 changes: 3 additions & 3 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ api_keys.json
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
/modules/flutter/coverage/
version

# packages file containing multi-root paths
Expand Down Expand Up @@ -104,7 +104,7 @@ unlinked_spec.ds
coverage/

# Submodules
packages/**/pubspec.lock
modules/**/pubspec.lock

# Web related
lib/generated_plugin_registrant.dart
Expand All @@ -120,7 +120,7 @@ app.*.map.json
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/modules/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
!.vscode/extensions.json
!.vscode/launch.json
Expand Down
2 changes: 1 addition & 1 deletion frontend/analysis_options.yaml
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
4 changes: 0 additions & 4 deletions frontend/l10n.yaml

This file was deleted.

15 changes: 5 additions & 10 deletions frontend/lib/main_development.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import 'package:apis/apis.dart';
import 'package:bloc_implementation/bloc_implementation.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart';
import 'package:realm/realm.dart' as realm_flutter;
import 'package:todo_bloc/bootstrap.dart';
import 'package:todo_bloc/firebase_options.dart';
import 'package:todo_bloc/src/app/app.dart';
import 'package:todo_bloc/src/data/models/dtos/queue/queue_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/todo/todo_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/user/user_dto.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -29,10 +26,8 @@ void main() async {
/// Configure internet connection checker
final internetConnectionInstance = InternetConnection.createInstance();

await bootstrap(
() => App(
realm: realm,
internetConnection: internetConnectionInstance,
),
await runBlocApp(
realm: realm,
internetConnection: internetConnectionInstance,
);
}
19 changes: 9 additions & 10 deletions frontend/lib/main_production.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'package:apis/apis.dart';
import 'package:bloc_implementation/bloc_implementation.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart';
import 'package:realm/realm.dart' as realm_flutter;
import 'package:todo_bloc/bootstrap.dart';
import 'package:todo_bloc/firebase_options.dart';
import 'package:todo_bloc/src/app/app.dart';
import 'package:todo_bloc/src/data/models/dtos/queue/queue_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/todo/todo_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/user/user_dto.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -16,6 +14,9 @@ void main() async {
options: DefaultFirebaseOptions.currentPlatform,
);

FirebaseFirestore.instance.settings =
const Settings(persistenceEnabled: false);

/// Configure local storage using realm
final config = realm_flutter.Configuration.local(
[TodoDTO.schema, UserDTO.schema, QueueDTO.schema],
Expand All @@ -25,10 +26,8 @@ void main() async {
/// Configure internet connection checker
final internetConnectionInstance = InternetConnection.createInstance();

await bootstrap(
() => App(
realm: realm,
internetConnection: internetConnectionInstance,
),
await runBlocApp(
realm: realm,
internetConnection: internetConnectionInstance,
);
}
19 changes: 9 additions & 10 deletions frontend/lib/main_staging.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'package:apis/apis.dart';
import 'package:bloc_implementation/bloc_implementation.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:internet_connection_checker_plus/internet_connection_checker_plus.dart';
import 'package:realm/realm.dart' as realm_flutter;
import 'package:todo_bloc/bootstrap.dart';
import 'package:todo_bloc/firebase_options.dart';
import 'package:todo_bloc/src/app/app.dart';
import 'package:todo_bloc/src/data/models/dtos/queue/queue_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/todo/todo_dto.dart';
import 'package:todo_bloc/src/data/models/dtos/user/user_dto.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -16,6 +14,9 @@ void main() async {
options: DefaultFirebaseOptions.currentPlatform,
);

FirebaseFirestore.instance.settings =
const Settings(persistenceEnabled: false);

/// Configure local storage using realm
final config = realm_flutter.Configuration.local(
[TodoDTO.schema, UserDTO.schema, QueueDTO.schema],
Expand All @@ -25,10 +26,8 @@ void main() async {
/// Configure internet connection checker
final internetConnectionInstance = InternetConnection.createInstance();

await bootstrap(
() => App(
realm: realm,
internetConnection: internetConnectionInstance,
),
await runBlocApp(
realm: realm,
internetConnection: internetConnectionInstance,
);
}
3 changes: 0 additions & 3 deletions frontend/lib/src/core/constants/environment.dart

This file was deleted.

7 changes: 0 additions & 7 deletions frontend/lib/src/core/global_imports.dart

This file was deleted.

1 change: 0 additions & 1 deletion frontend/lib/src/data/api/settings_api.dart

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions frontend/lib/src/l10n/arb/app_en.arb

This file was deleted.

7 changes: 0 additions & 7 deletions frontend/lib/src/l10n/arb/app_es.arb

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/lib/src/l10n/l10n.dart

This file was deleted.

9 changes: 0 additions & 9 deletions frontend/lib/src/modules/settings/cubit/settings_cubit.dart

This file was deleted.

Loading

0 comments on commit 637dbe0

Please sign in to comment.