-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #457 from hpi-studyu/issue/432-feature-designer-da…
…shboard-improvements feat: Designer Dashboard Improvements
- Loading branch information
Showing
83 changed files
with
39,332 additions
and
37,141 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,51 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import 'package:studyu_core/core.dart'; | ||
|
||
part 'user.g.dart'; | ||
|
||
@JsonSerializable() | ||
class StudyUUser extends SupabaseObjectFunctions<StudyUUser> { | ||
static const String tableName = 'user'; | ||
|
||
@override | ||
Map<String, dynamic> get primaryKeys => {'id': id}; | ||
|
||
@JsonKey(name: 'id') | ||
String id; | ||
@JsonKey(name: 'email') | ||
String email; | ||
@JsonKey(name: 'preferences') | ||
Preferences preferences; | ||
|
||
StudyUUser({required this.id, required this.email, Preferences? preferences}) | ||
: preferences = preferences ?? Preferences(); | ||
|
||
factory StudyUUser.fromJson(Map<String, dynamic> json) => _$StudyUUserFromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$StudyUUserToJson(this); | ||
} | ||
|
||
@JsonSerializable() | ||
class Preferences { | ||
// todo store preferred user language in database | ||
@JsonKey(name: 'lang') | ||
String language; | ||
|
||
@JsonKey(name: 'pinned_studies') | ||
Set<String> pinnedStudies; | ||
|
||
Preferences({this.language = '', this.pinnedStudies = const {}}); | ||
|
||
factory Preferences.fromJson(Map<String, dynamic> json) => _$PreferencesFromJson(json); | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> json = _$PreferencesToJson(this); | ||
// Remove empty fields from the JSON map | ||
json.removeWhere( | ||
(key, value) => value == null || value is String && value.isEmpty || value is Set && value.isEmpty, | ||
); | ||
return json; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,12 @@ | ||
ALTER TABLE public."user" ADD COLUMN preferences jsonb; | ||
|
||
|
||
-- | ||
-- Name: Allow users to manage their own user; Type: POLICY; Schema: public; Owner: supabase_admin | ||
-- | ||
|
||
CREATE POLICY "Allow users to manage their own user" | ||
ON public."user" FOR ALL | ||
USING ( | ||
auth.uid() = id | ||
); |
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
Oops, something went wrong.