Skip to content

Commit 450f140

Browse files
added batch create users
1 parent 89b4b3a commit 450f140

33 files changed

Lines changed: 4969 additions & 2787 deletions

docs/model_relations/school_data_hub_server.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
11+
// ignore_for_file: no_leading_underscores_for_library_prefixes
12+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
13+
14+
abstract class BatchCreateUserError implements _i1.SerializableModel {
15+
BatchCreateUserError._({
16+
required this.rowIndex,
17+
required this.userNameOrKurzel,
18+
required this.message,
19+
});
20+
21+
factory BatchCreateUserError({
22+
required int rowIndex,
23+
required String userNameOrKurzel,
24+
required String message,
25+
}) = _BatchCreateUserErrorImpl;
26+
27+
factory BatchCreateUserError.fromJson(
28+
Map<String, dynamic> jsonSerialization) {
29+
return BatchCreateUserError(
30+
rowIndex: jsonSerialization['rowIndex'] as int,
31+
userNameOrKurzel: jsonSerialization['userNameOrKurzel'] as String,
32+
message: jsonSerialization['message'] as String,
33+
);
34+
}
35+
36+
int rowIndex;
37+
38+
String userNameOrKurzel;
39+
40+
String message;
41+
42+
/// Returns a shallow copy of this [BatchCreateUserError]
43+
/// with some or all fields replaced by the given arguments.
44+
@_i1.useResult
45+
BatchCreateUserError copyWith({
46+
int? rowIndex,
47+
String? userNameOrKurzel,
48+
String? message,
49+
});
50+
@override
51+
Map<String, dynamic> toJson() {
52+
return {
53+
'rowIndex': rowIndex,
54+
'userNameOrKurzel': userNameOrKurzel,
55+
'message': message,
56+
};
57+
}
58+
59+
@override
60+
String toString() {
61+
return _i1.SerializationManager.encode(this);
62+
}
63+
}
64+
65+
class _BatchCreateUserErrorImpl extends BatchCreateUserError {
66+
_BatchCreateUserErrorImpl({
67+
required int rowIndex,
68+
required String userNameOrKurzel,
69+
required String message,
70+
}) : super._(
71+
rowIndex: rowIndex,
72+
userNameOrKurzel: userNameOrKurzel,
73+
message: message,
74+
);
75+
76+
/// Returns a shallow copy of this [BatchCreateUserError]
77+
/// with some or all fields replaced by the given arguments.
78+
@_i1.useResult
79+
@override
80+
BatchCreateUserError copyWith({
81+
int? rowIndex,
82+
String? userNameOrKurzel,
83+
String? message,
84+
}) {
85+
return BatchCreateUserError(
86+
rowIndex: rowIndex ?? this.rowIndex,
87+
userNameOrKurzel: userNameOrKurzel ?? this.userNameOrKurzel,
88+
message: message ?? this.message,
89+
);
90+
}
91+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
11+
// ignore_for_file: no_leading_underscores_for_library_prefixes
12+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
13+
import '../../../_features/admin/models/created_user_credential.dart' as _i2;
14+
import '../../../_features/admin/models/batch_create_user_error.dart' as _i3;
15+
16+
abstract class BatchCreateUsersResponse implements _i1.SerializableModel {
17+
BatchCreateUsersResponse._({
18+
required this.credentials,
19+
required this.errors,
20+
});
21+
22+
factory BatchCreateUsersResponse({
23+
required List<_i2.CreatedUserCredential> credentials,
24+
required List<_i3.BatchCreateUserError> errors,
25+
}) = _BatchCreateUsersResponseImpl;
26+
27+
factory BatchCreateUsersResponse.fromJson(
28+
Map<String, dynamic> jsonSerialization) {
29+
return BatchCreateUsersResponse(
30+
credentials: (jsonSerialization['credentials'] as List)
31+
.map((e) =>
32+
_i2.CreatedUserCredential.fromJson((e as Map<String, dynamic>)))
33+
.toList(),
34+
errors: (jsonSerialization['errors'] as List)
35+
.map((e) =>
36+
_i3.BatchCreateUserError.fromJson((e as Map<String, dynamic>)))
37+
.toList(),
38+
);
39+
}
40+
41+
List<_i2.CreatedUserCredential> credentials;
42+
43+
List<_i3.BatchCreateUserError> errors;
44+
45+
/// Returns a shallow copy of this [BatchCreateUsersResponse]
46+
/// with some or all fields replaced by the given arguments.
47+
@_i1.useResult
48+
BatchCreateUsersResponse copyWith({
49+
List<_i2.CreatedUserCredential>? credentials,
50+
List<_i3.BatchCreateUserError>? errors,
51+
});
52+
@override
53+
Map<String, dynamic> toJson() {
54+
return {
55+
'credentials': credentials.toJson(valueToJson: (v) => v.toJson()),
56+
'errors': errors.toJson(valueToJson: (v) => v.toJson()),
57+
};
58+
}
59+
60+
@override
61+
String toString() {
62+
return _i1.SerializationManager.encode(this);
63+
}
64+
}
65+
66+
class _BatchCreateUsersResponseImpl extends BatchCreateUsersResponse {
67+
_BatchCreateUsersResponseImpl({
68+
required List<_i2.CreatedUserCredential> credentials,
69+
required List<_i3.BatchCreateUserError> errors,
70+
}) : super._(
71+
credentials: credentials,
72+
errors: errors,
73+
);
74+
75+
/// Returns a shallow copy of this [BatchCreateUsersResponse]
76+
/// with some or all fields replaced by the given arguments.
77+
@_i1.useResult
78+
@override
79+
BatchCreateUsersResponse copyWith({
80+
List<_i2.CreatedUserCredential>? credentials,
81+
List<_i3.BatchCreateUserError>? errors,
82+
}) {
83+
return BatchCreateUsersResponse(
84+
credentials:
85+
credentials ?? this.credentials.map((e0) => e0.copyWith()).toList(),
86+
errors: errors ?? this.errors.map((e0) => e0.copyWith()).toList(),
87+
);
88+
}
89+
}
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
11+
// ignore_for_file: no_leading_underscores_for_library_prefixes
12+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
13+
import '../../../_features/user/models/roles.dart' as _i2;
14+
15+
abstract class CreateUserRequest implements _i1.SerializableModel {
16+
CreateUserRequest._({
17+
required this.userName,
18+
required this.fullName,
19+
required this.email,
20+
required this.password,
21+
required this.role,
22+
required this.timeUnits,
23+
required this.reliefTimeUnits,
24+
required this.scopeNames,
25+
required this.isTester,
26+
this.matrixUserId,
27+
this.credit,
28+
this.pupilsAuth,
29+
});
30+
31+
factory CreateUserRequest({
32+
required String userName,
33+
required String fullName,
34+
required String email,
35+
required String password,
36+
required _i2.Role role,
37+
required int timeUnits,
38+
required int reliefTimeUnits,
39+
required List<String> scopeNames,
40+
required bool isTester,
41+
String? matrixUserId,
42+
int? credit,
43+
Set<int>? pupilsAuth,
44+
}) = _CreateUserRequestImpl;
45+
46+
factory CreateUserRequest.fromJson(Map<String, dynamic> jsonSerialization) {
47+
return CreateUserRequest(
48+
userName: jsonSerialization['userName'] as String,
49+
fullName: jsonSerialization['fullName'] as String,
50+
email: jsonSerialization['email'] as String,
51+
password: jsonSerialization['password'] as String,
52+
role: _i2.Role.fromJson((jsonSerialization['role'] as String)),
53+
timeUnits: jsonSerialization['timeUnits'] as int,
54+
reliefTimeUnits: jsonSerialization['reliefTimeUnits'] as int,
55+
scopeNames: (jsonSerialization['scopeNames'] as List)
56+
.map((e) => e as String)
57+
.toList(),
58+
isTester: jsonSerialization['isTester'] as bool,
59+
matrixUserId: jsonSerialization['matrixUserId'] as String?,
60+
credit: jsonSerialization['credit'] as int?,
61+
pupilsAuth: jsonSerialization['pupilsAuth'] == null
62+
? null
63+
: _i1.SetJsonExtension.fromJson(
64+
(jsonSerialization['pupilsAuth'] as List),
65+
itemFromJson: (e) => e as int),
66+
);
67+
}
68+
69+
String userName;
70+
71+
String fullName;
72+
73+
String email;
74+
75+
String password;
76+
77+
_i2.Role role;
78+
79+
int timeUnits;
80+
81+
int reliefTimeUnits;
82+
83+
List<String> scopeNames;
84+
85+
bool isTester;
86+
87+
String? matrixUserId;
88+
89+
int? credit;
90+
91+
Set<int>? pupilsAuth;
92+
93+
/// Returns a shallow copy of this [CreateUserRequest]
94+
/// with some or all fields replaced by the given arguments.
95+
@_i1.useResult
96+
CreateUserRequest copyWith({
97+
String? userName,
98+
String? fullName,
99+
String? email,
100+
String? password,
101+
_i2.Role? role,
102+
int? timeUnits,
103+
int? reliefTimeUnits,
104+
List<String>? scopeNames,
105+
bool? isTester,
106+
String? matrixUserId,
107+
int? credit,
108+
Set<int>? pupilsAuth,
109+
});
110+
@override
111+
Map<String, dynamic> toJson() {
112+
return {
113+
'userName': userName,
114+
'fullName': fullName,
115+
'email': email,
116+
'password': password,
117+
'role': role.toJson(),
118+
'timeUnits': timeUnits,
119+
'reliefTimeUnits': reliefTimeUnits,
120+
'scopeNames': scopeNames.toJson(),
121+
'isTester': isTester,
122+
if (matrixUserId != null) 'matrixUserId': matrixUserId,
123+
if (credit != null) 'credit': credit,
124+
if (pupilsAuth != null) 'pupilsAuth': pupilsAuth?.toJson(),
125+
};
126+
}
127+
128+
@override
129+
String toString() {
130+
return _i1.SerializationManager.encode(this);
131+
}
132+
}
133+
134+
class _Undefined {}
135+
136+
class _CreateUserRequestImpl extends CreateUserRequest {
137+
_CreateUserRequestImpl({
138+
required String userName,
139+
required String fullName,
140+
required String email,
141+
required String password,
142+
required _i2.Role role,
143+
required int timeUnits,
144+
required int reliefTimeUnits,
145+
required List<String> scopeNames,
146+
required bool isTester,
147+
String? matrixUserId,
148+
int? credit,
149+
Set<int>? pupilsAuth,
150+
}) : super._(
151+
userName: userName,
152+
fullName: fullName,
153+
email: email,
154+
password: password,
155+
role: role,
156+
timeUnits: timeUnits,
157+
reliefTimeUnits: reliefTimeUnits,
158+
scopeNames: scopeNames,
159+
isTester: isTester,
160+
matrixUserId: matrixUserId,
161+
credit: credit,
162+
pupilsAuth: pupilsAuth,
163+
);
164+
165+
/// Returns a shallow copy of this [CreateUserRequest]
166+
/// with some or all fields replaced by the given arguments.
167+
@_i1.useResult
168+
@override
169+
CreateUserRequest copyWith({
170+
String? userName,
171+
String? fullName,
172+
String? email,
173+
String? password,
174+
_i2.Role? role,
175+
int? timeUnits,
176+
int? reliefTimeUnits,
177+
List<String>? scopeNames,
178+
bool? isTester,
179+
Object? matrixUserId = _Undefined,
180+
Object? credit = _Undefined,
181+
Object? pupilsAuth = _Undefined,
182+
}) {
183+
return CreateUserRequest(
184+
userName: userName ?? this.userName,
185+
fullName: fullName ?? this.fullName,
186+
email: email ?? this.email,
187+
password: password ?? this.password,
188+
role: role ?? this.role,
189+
timeUnits: timeUnits ?? this.timeUnits,
190+
reliefTimeUnits: reliefTimeUnits ?? this.reliefTimeUnits,
191+
scopeNames: scopeNames ?? this.scopeNames.map((e0) => e0).toList(),
192+
isTester: isTester ?? this.isTester,
193+
matrixUserId: matrixUserId is String? ? matrixUserId : this.matrixUserId,
194+
credit: credit is int? ? credit : this.credit,
195+
pupilsAuth: pupilsAuth is Set<int>?
196+
? pupilsAuth
197+
: this.pupilsAuth?.map((e0) => e0).toSet(),
198+
);
199+
}
200+
}

0 commit comments

Comments
 (0)