chore: fix and format using melos
This commit is contained in:
@@ -32,14 +32,15 @@ enum EmailVerificationAction {
|
||||
changeEmail;
|
||||
|
||||
String toSnakeCase() => name.splitMapJoin(
|
||||
RegExp('[A-Z]'),
|
||||
onMatch: (m) => '_${m[0]?.toLowerCase()}',
|
||||
onNonMatch: (n) => n,
|
||||
);
|
||||
RegExp('[A-Z]'),
|
||||
onMatch: (m) => '_${m[0]?.toLowerCase()}',
|
||||
onNonMatch: (n) => n,
|
||||
);
|
||||
|
||||
factory EmailVerificationAction.fromString(String str) => EmailVerificationAction.values.firstWhere(
|
||||
(element) => element.toSnakeCase() == str,
|
||||
);
|
||||
factory EmailVerificationAction.fromString(String str) =>
|
||||
EmailVerificationAction.values.firstWhere(
|
||||
(element) => element.toSnakeCase() == str,
|
||||
);
|
||||
}
|
||||
|
||||
class VerifyCode {
|
||||
@@ -56,23 +57,24 @@ class VerifyCode {
|
||||
String? email,
|
||||
String? verificationCode,
|
||||
EmailVerificationAction? action,
|
||||
}) => VerifyCode(
|
||||
email: email ?? this.email,
|
||||
verificationCode: verificationCode ?? this.verificationCode,
|
||||
action: action ?? this.action,
|
||||
);
|
||||
}) =>
|
||||
VerifyCode(
|
||||
email: email ?? this.email,
|
||||
verificationCode: verificationCode ?? this.verificationCode,
|
||||
action: action ?? this.action,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => <String, dynamic>{
|
||||
'email': email,
|
||||
'verification_code': verificationCode,
|
||||
'action': action.toSnakeCase(),
|
||||
};
|
||||
'email': email,
|
||||
'verification_code': verificationCode,
|
||||
'action': action.toSnakeCase(),
|
||||
};
|
||||
|
||||
factory VerifyCode.fromMap(Map<String, dynamic> map) => VerifyCode(
|
||||
email: map['email'] as String,
|
||||
verificationCode: map['verification_code'] as String,
|
||||
action: EmailVerificationAction.fromString(map['action'] as String),
|
||||
);
|
||||
email: map['email'] as String,
|
||||
verificationCode: map['verification_code'] as String,
|
||||
action: EmailVerificationAction.fromString(map['action'] as String),
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
@@ -95,20 +97,22 @@ class Account {
|
||||
Account copyWith({
|
||||
String? email,
|
||||
String? sessionId,
|
||||
}) => Account(
|
||||
email: email ?? this.email,
|
||||
sessionId: sessionId ?? this.sessionId,
|
||||
);
|
||||
}) =>
|
||||
Account(
|
||||
email: email ?? this.email,
|
||||
sessionId: sessionId ?? this.sessionId,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => <String, dynamic>{
|
||||
'email': email,
|
||||
'session_id': sessionId,
|
||||
};
|
||||
'email': email,
|
||||
'session_id': sessionId,
|
||||
};
|
||||
|
||||
factory Account.fromMap(Map<String, dynamic> map) => Account(
|
||||
email: map['email'] as String,
|
||||
sessionId: map['session_id'] != null ? map['session_id'] as String : null,
|
||||
);
|
||||
email: map['email'] as String,
|
||||
sessionId:
|
||||
map['session_id'] != null ? map['session_id'] as String : null,
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
@@ -130,20 +134,21 @@ class SignUp {
|
||||
SignUp copyWith({
|
||||
String? sessionId,
|
||||
String? password,
|
||||
}) => SignUp(
|
||||
sessionId: sessionId ?? this.sessionId,
|
||||
password: password ?? this.password,
|
||||
);
|
||||
}) =>
|
||||
SignUp(
|
||||
sessionId: sessionId ?? this.sessionId,
|
||||
password: password ?? this.password,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => <String, dynamic>{
|
||||
'session_id': sessionId,
|
||||
'password': password,
|
||||
};
|
||||
'session_id': sessionId,
|
||||
'password': password,
|
||||
};
|
||||
|
||||
factory SignUp.fromMap(Map<String, dynamic> map) => SignUp(
|
||||
sessionId: map['session_id'] as String,
|
||||
password: map['password'] as String,
|
||||
);
|
||||
sessionId: map['session_id'] as String,
|
||||
password: map['password'] as String,
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
@@ -168,23 +173,24 @@ class TokenSuccess {
|
||||
String? accessToken,
|
||||
String? refreshToken,
|
||||
Account? account,
|
||||
}) => TokenSuccess(
|
||||
accessToken: accessToken ?? this.accessToken,
|
||||
refreshToken: refreshToken ?? this.refreshToken,
|
||||
account: account ?? this.account,
|
||||
);
|
||||
}) =>
|
||||
TokenSuccess(
|
||||
accessToken: accessToken ?? this.accessToken,
|
||||
refreshToken: refreshToken ?? this.refreshToken,
|
||||
account: account ?? this.account,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => <String, dynamic>{
|
||||
'access_token': accessToken,
|
||||
'refresh_token': refreshToken,
|
||||
'account': account.toMap(),
|
||||
};
|
||||
'access_token': accessToken,
|
||||
'refresh_token': refreshToken,
|
||||
'account': account.toMap(),
|
||||
};
|
||||
|
||||
factory TokenSuccess.fromMap(Map<String, dynamic> map) => TokenSuccess(
|
||||
accessToken: map['access_token'] as String,
|
||||
refreshToken: map['refresh_token'] as String,
|
||||
account: Account.fromMap(map['account'] as Map<String, dynamic>),
|
||||
);
|
||||
accessToken: map['access_token'] as String,
|
||||
refreshToken: map['refresh_token'] as String,
|
||||
account: Account.fromMap(map['account'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
@@ -207,20 +213,21 @@ class Login {
|
||||
Login copyWith({
|
||||
String? email,
|
||||
String? password,
|
||||
}) => Login(
|
||||
email: email ?? this.email,
|
||||
password: password ?? this.password,
|
||||
);
|
||||
}) =>
|
||||
Login(
|
||||
email: email ?? this.email,
|
||||
password: password ?? this.password,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => <String, dynamic>{
|
||||
'email': email,
|
||||
'password': password,
|
||||
};
|
||||
'email': email,
|
||||
'password': password,
|
||||
};
|
||||
|
||||
factory Login.fromMap(Map<String, dynamic> map) => Login(
|
||||
email: map['email'] as String,
|
||||
password: map['password'] as String,
|
||||
);
|
||||
email: map['email'] as String,
|
||||
password: map['password'] as String,
|
||||
);
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user