chore: make orgId mandatory in CreateAppRequest (#2523)

This commit is contained in:
Bryan Oltman
2024-10-09 16:41:14 -04:00
committed by GitHub
parent 729a95de8a
commit 04be44e44b
3 changed files with 8 additions and 6 deletions
@@ -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;
}
@@ -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,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()),