chore: make orgId mandatory in CreateAppRequest (#2523)
This commit is contained in:
+3
-4
@@ -10,7 +10,7 @@ class CreateAppRequest {
|
||||
/// {@macro create_app_request}
|
||||
const CreateAppRequest({
|
||||
required this.displayName,
|
||||
this.organizationId,
|
||||
required this.organizationId,
|
||||
});
|
||||
|
||||
/// Converts a Map<String, dynamic> to a [CreateAppRequest]
|
||||
@@ -23,7 +23,6 @@ class CreateAppRequest {
|
||||
/// The display name of the app.
|
||||
final String displayName;
|
||||
|
||||
/// The id of organization that this app will belong to. If no id is provided,
|
||||
/// this app will belong to the user's personal organization.
|
||||
final int? organizationId;
|
||||
/// The id of organization that this app will belong to.
|
||||
final int organizationId;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ CreateAppRequest _$CreateAppRequestFromJson(Map<String, dynamic> json) =>
|
||||
final val = CreateAppRequest(
|
||||
displayName: $checkedConvert('display_name', (v) => v as String),
|
||||
organizationId:
|
||||
$checkedConvert('organization_id', (v) => (v as num?)?.toInt()),
|
||||
$checkedConvert('organization_id', (v) => (v as num).toInt()),
|
||||
);
|
||||
return val;
|
||||
},
|
||||
|
||||
+4
-1
@@ -4,7 +4,10 @@ import 'package:test/test.dart';
|
||||
void main() {
|
||||
group(CreateAppRequest, () {
|
||||
test('can be (de)serialized', () {
|
||||
const request = CreateAppRequest(displayName: 'display_name');
|
||||
const request = CreateAppRequest(
|
||||
displayName: 'display_name',
|
||||
organizationId: 123,
|
||||
);
|
||||
expect(
|
||||
CreateAppRequest.fromJson(request.toJson()).toJson(),
|
||||
equals(request.toJson()),
|
||||
|
||||
Reference in New Issue
Block a user