Skip to content

Commit 21f7972

Browse files
authored
Merge pull request #32 from CoderJava/feature/buat-fitur-pengaturan-sign-up-method
Feature - Buat fitur pengaturan user registration workflow
2 parents a0ad65c + 036f827 commit 21f7972

File tree

12 files changed

+345
-229
lines changed

12 files changed

+345
-229
lines changed

assets/translations/en-US.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,14 @@
294294
"finish_date_time_must_be_after_of_start_date_time": "The finish date time must be after the start date time",
295295
"reason": "Reason",
296296
"why_are_you_adding_manual_track": "e.g. Forgot to start timer",
297-
"please_stop_the_timer_if_you_want_to_logout": "Please stop the timer if you want to logout."
297+
"please_stop_the_timer_if_you_want_to_logout": "Please stop the timer if you want to logout.",
298+
"user_registration": "User Registration",
299+
"subtitle_user_registration": "Configuring approval workflow for user registration.",
300+
"user_registration_workflow_successfully_updated": "User registration workflow successfully updated",
301+
"user_registration_workflow": "User Registration Workflow",
302+
"auto_approval": "Auto Approval",
303+
"description_auto_approval": "New user registration are automatically approved after submitting the registration form.",
304+
"manual_approval": "Manual Approval",
305+
"description_manual_approval": "New user registration are held in a moderation queue and require an super admin to approve them.",
306+
"please_choose_user_registration_workflow": "Please choose user registration workflow"
298307
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
enum SignUpMethod {
2+
manual,
3+
auto,
4+
}
5+
6+
extension SignUpMethodExtension on SignUpMethod {
7+
String toValue() {
8+
switch (this) {
9+
case SignUpMethod.manual:
10+
return 'manual_approval';
11+
case SignUpMethod.auto:
12+
return 'auto_approval';
13+
default:
14+
return '';
15+
}
16+
}
17+
18+
static SignUpMethod? parseString(String value) {
19+
if (value.contains('manual')) {
20+
return SignUpMethod.manual;
21+
} else if (value.contains('auto')) {
22+
return SignUpMethod.auto;
23+
}
24+
return null;
25+
}
26+
}

lib/feature/data/model/kv_setting/kv_setting_body.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ part 'kv_setting_body.g.dart';
77
class KvSettingBody extends Equatable {
88
@JsonKey(name: 'discord_channel_id')
99
final String? discordChannelId;
10+
@JsonKey(name: 'sign_up_method')
11+
final String? signUpMethod;
1012

11-
KvSettingBody({required this.discordChannelId});
13+
KvSettingBody({
14+
required this.discordChannelId,
15+
required this.signUpMethod,
16+
});
1217

1318
factory KvSettingBody.fromJson(Map<String, dynamic> json) => _$KvSettingBodyFromJson(json);
1419

1520
Map<String, dynamic> toJson() => _$KvSettingBodyToJson(this);
1621

1722
@override
1823
List<Object?> get props => [
19-
discordChannelId,
20-
];
24+
discordChannelId,
25+
signUpMethod,
26+
];
2127

2228
@override
2329
String toString() {
24-
return 'KvSettingBody{discordChannelId: $discordChannelId}';
30+
return 'KvSettingBody{discordChannelId: $discordChannelId, signUpMethod: $signUpMethod}';
2531
}
26-
}
32+
}

lib/feature/data/model/kv_setting/kv_setting_response.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ part 'kv_setting_response.g.dart';
77
class KvSettingResponse extends Equatable {
88
@JsonKey(name: 'discord_channel_id')
99
final String? discordChannelId;
10+
@JsonKey(name: 'sign_up_method')
11+
final String? signUpMethod;
1012

1113
KvSettingResponse({
1214
required this.discordChannelId,
15+
required this.signUpMethod,
1316
});
1417

1518
factory KvSettingResponse.fromJson(Map<String, dynamic> json) => _$KvSettingResponseFromJson(json);
@@ -19,10 +22,11 @@ class KvSettingResponse extends Equatable {
1922
@override
2023
List<Object?> get props => [
2124
discordChannelId,
25+
signUpMethod,
2226
];
2327

2428
@override
2529
String toString() {
26-
return 'KvSettingResponse{discordChannelId: $discordChannelId}';
30+
return 'KvSettingResponse{discordChannelId: $discordChannelId, signUpMethod: $signUpMethod}';
2731
}
2832
}

0 commit comments

Comments
 (0)