Skip to content

Commit

Permalink
Merge pull request #32 from CoderJava/feature/buat-fitur-pengaturan-s…
Browse files Browse the repository at this point in the history
…ign-up-method

Feature - Buat fitur pengaturan user registration workflow
  • Loading branch information
CoderJava authored Oct 12, 2023
2 parents a0ad65c + 036f827 commit 21f7972
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 229 deletions.
11 changes: 10 additions & 1 deletion assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,5 +294,14 @@
"finish_date_time_must_be_after_of_start_date_time": "The finish date time must be after the start date time",
"reason": "Reason",
"why_are_you_adding_manual_track": "e.g. Forgot to start timer",
"please_stop_the_timer_if_you_want_to_logout": "Please stop the timer if you want to logout."
"please_stop_the_timer_if_you_want_to_logout": "Please stop the timer if you want to logout.",
"user_registration": "User Registration",
"subtitle_user_registration": "Configuring approval workflow for user registration.",
"user_registration_workflow_successfully_updated": "User registration workflow successfully updated",
"user_registration_workflow": "User Registration Workflow",
"auto_approval": "Auto Approval",
"description_auto_approval": "New user registration are automatically approved after submitting the registration form.",
"manual_approval": "Manual Approval",
"description_manual_approval": "New user registration are held in a moderation queue and require an super admin to approve them.",
"please_choose_user_registration_workflow": "Please choose user registration workflow"
}
26 changes: 26 additions & 0 deletions lib/core/util/enum/sign_up_method.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
enum SignUpMethod {
manual,
auto,
}

extension SignUpMethodExtension on SignUpMethod {
String toValue() {
switch (this) {
case SignUpMethod.manual:
return 'manual_approval';
case SignUpMethod.auto:
return 'auto_approval';
default:
return '';
}
}

static SignUpMethod? parseString(String value) {
if (value.contains('manual')) {
return SignUpMethod.manual;
} else if (value.contains('auto')) {
return SignUpMethod.auto;
}
return null;
}
}
16 changes: 11 additions & 5 deletions lib/feature/data/model/kv_setting/kv_setting_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ part 'kv_setting_body.g.dart';
class KvSettingBody extends Equatable {
@JsonKey(name: 'discord_channel_id')
final String? discordChannelId;
@JsonKey(name: 'sign_up_method')
final String? signUpMethod;

KvSettingBody({required this.discordChannelId});
KvSettingBody({
required this.discordChannelId,
required this.signUpMethod,
});

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

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

@override
List<Object?> get props => [
discordChannelId,
];
discordChannelId,
signUpMethod,
];

@override
String toString() {
return 'KvSettingBody{discordChannelId: $discordChannelId}';
return 'KvSettingBody{discordChannelId: $discordChannelId, signUpMethod: $signUpMethod}';
}
}
}
6 changes: 5 additions & 1 deletion lib/feature/data/model/kv_setting/kv_setting_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ part 'kv_setting_response.g.dart';
class KvSettingResponse extends Equatable {
@JsonKey(name: 'discord_channel_id')
final String? discordChannelId;
@JsonKey(name: 'sign_up_method')
final String? signUpMethod;

KvSettingResponse({
required this.discordChannelId,
required this.signUpMethod,
});

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

@override
String toString() {
return 'KvSettingResponse{discordChannelId: $discordChannelId}';
return 'KvSettingResponse{discordChannelId: $discordChannelId, signUpMethod: $signUpMethod}';
}
}
Loading

0 comments on commit 21f7972

Please sign in to comment.