-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPIKE] Isolate firebase dependency #46
Open
gesellc
wants to merge
4
commits into
master
Choose a base branch
from
isolate-firebase-dependency
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:frontend/models/event.dart'; | ||
import 'package:frontend/models/sailing_club.dart'; | ||
import 'package:frontend/models/boat.dart'; | ||
|
||
// TODO: Should we have a percistency Interface that is segregated from the authentication interface? | ||
|
||
abstract class PersistencyService { | ||
// final RegattaStore _store; | ||
|
||
// PersistencyService(this._store); | ||
|
||
Future signIn(); | ||
void signOut(); | ||
|
||
// These private methods are called by implementing classes | ||
// to propagate changes in the DB to the frontend. | ||
/* | ||
void newEvent(Event newEvent) { | ||
_store.dispatch(actions.addEvent(newEvent)); | ||
} | ||
|
||
void _changedEvent(Event changedEvent) { | ||
_store.dispatch(actions.updateEvent(changedEvent)); | ||
} | ||
|
||
void _removedEvent(Event removedEvent) { | ||
_store.dispatch(actions.deleteEvent(removedEvent)); | ||
} | ||
|
||
void _newSailingClub(SailingClub sc) { | ||
_store.dispatch(actions.addSailingClub(sc)); | ||
} | ||
|
||
void _changedSailingClub(SailingClub sc) { | ||
_store.dispatch(actions.updateSailingClub(sc)); | ||
} | ||
|
||
void _removedSailingClub(SailingClub sc) { | ||
_store.dispatch(actions.deleteSailingClub(sc)); | ||
} | ||
|
||
void _newBoat(Boat boat) { | ||
_store.dispatch(actions.addBoat(boat)); | ||
} | ||
|
||
void _changedBoat(Boat boat) { | ||
_store.dispatch(actions.updateBoat(boat)); | ||
} | ||
|
||
void _removedBoat(Boat boat) { | ||
_store.dispatch(actions.deleteBoat(boat)); | ||
} | ||
*/ | ||
// The following methods are called by the frontend | ||
// to write to the DB. | ||
|
||
Future addEvent(Event event); | ||
Future updateEvent(Event event); | ||
Future deleteEvent(Event event); | ||
|
||
Future addSailingClub(SailingClub sailingClub); | ||
Future updateSailingClub(SailingClub sailingClub); | ||
Future deleteSailingClub(SailingClub sailingClub); | ||
|
||
Future addBoat(Boat boat); | ||
Future updateBoat(Boat boat); | ||
Future deleteBoat(Boat boat); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I am not sure about those methods. I think they only exist for the Firebase usecase. E.g. if we would have a databse or file as a backend, we would do the saving to disk and dispatching the success in a single method without the need of an async callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently those are commented out and only introduced in the FirebaseService Class. But mostly because I didn't find a way to make it work as a abstract class/implementation pair.
My reasoning to have those in the PercistencyService Class was that the frontend currently assumes async communication with the persistency layer - specifically in the action design. I would then assume that we need some sort of success messages flowing back to the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial reason of defining those in the PercistencyService Class was to decouple the usage of Redux in the frontend from the usage of firebase in the backend.
If this goal is even valid might also need some discussion... :-)