Skip to content
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

feat(shorebird_code_push_protocol): Add email field to User #276

Merged
merged 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ part 'user.g.dart';
@JsonSerializable()
class User {
/// {@macro user}
const User({required this.id, this.hasActiveSubscription = false});
const User({
required this.id,
required this.email,
this.hasActiveSubscription = false,
});

/// Converts a Map<String, dynamic> to a [User]
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
Expand All @@ -19,6 +23,9 @@ class User {
/// The unique user identifier.
final int id;

/// The user's email address, as provided by the user during signup.
final String email;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to expose this atm?


/// Whether the user is currently a paying customer.
final bool hasActiveSubscription;
}

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
Expand Up @@ -4,7 +4,7 @@ import 'package:test/test.dart';
void main() {
group('User', () {
test('can be (de)serialized', () {
const user = User(id: 1);
const user = User(id: 1, email: 'test@shorebird.dev');
expect(
User.fromJson(user.toJson()).toJson(),
equals(user.toJson()),
Expand Down