mirror of
https://github.com/immich-app/immich
synced 2025-06-07 23:31:04 +00:00
fix: missing permissions and optional update (#18735)
* fix: missing permissions * fix: test
This commit is contained in:
parent
10181defb1
commit
6f39a706b2
20
mobile/openapi/lib/model/api_key_update_dto.dart
generated
20
mobile/openapi/lib/model/api_key_update_dto.dart
generated
@ -13,11 +13,17 @@ part of openapi.api;
|
|||||||
class APIKeyUpdateDto {
|
class APIKeyUpdateDto {
|
||||||
/// Returns a new [APIKeyUpdateDto] instance.
|
/// Returns a new [APIKeyUpdateDto] instance.
|
||||||
APIKeyUpdateDto({
|
APIKeyUpdateDto({
|
||||||
required this.name,
|
this.name,
|
||||||
this.permissions = const [],
|
this.permissions = const [],
|
||||||
});
|
});
|
||||||
|
|
||||||
String name;
|
///
|
||||||
|
/// Please note: This property should have been non-nullable! Since the specification file
|
||||||
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
|
/// source code must fall back to having a nullable type.
|
||||||
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||||
|
///
|
||||||
|
String? name;
|
||||||
|
|
||||||
List<Permission> permissions;
|
List<Permission> permissions;
|
||||||
|
|
||||||
@ -29,7 +35,7 @@ class APIKeyUpdateDto {
|
|||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
// ignore: unnecessary_parenthesis
|
// ignore: unnecessary_parenthesis
|
||||||
(name.hashCode) +
|
(name == null ? 0 : name!.hashCode) +
|
||||||
(permissions.hashCode);
|
(permissions.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -37,7 +43,11 @@ class APIKeyUpdateDto {
|
|||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
|
if (this.name != null) {
|
||||||
json[r'name'] = this.name;
|
json[r'name'] = this.name;
|
||||||
|
} else {
|
||||||
|
// json[r'name'] = null;
|
||||||
|
}
|
||||||
json[r'permissions'] = this.permissions;
|
json[r'permissions'] = this.permissions;
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@ -51,7 +61,7 @@ class APIKeyUpdateDto {
|
|||||||
final json = value.cast<String, dynamic>();
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
return APIKeyUpdateDto(
|
return APIKeyUpdateDto(
|
||||||
name: mapValueOfType<String>(json, r'name')!,
|
name: mapValueOfType<String>(json, r'name'),
|
||||||
permissions: Permission.listFromJson(json[r'permissions']),
|
permissions: Permission.listFromJson(json[r'permissions']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -100,8 +110,6 @@ class APIKeyUpdateDto {
|
|||||||
|
|
||||||
/// The list of required keys that must be present in a JSON.
|
/// The list of required keys that must be present in a JSON.
|
||||||
static const requiredKeys = <String>{
|
static const requiredKeys = <String>{
|
||||||
'name',
|
|
||||||
'permissions',
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8335,10 +8335,6 @@
|
|||||||
"type": "array"
|
"type": "array"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
|
||||||
"name",
|
|
||||||
"permissions"
|
|
||||||
],
|
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"ActivityCreateDto": {
|
"ActivityCreateDto": {
|
||||||
|
@ -415,8 +415,8 @@ export type ApiKeyCreateResponseDto = {
|
|||||||
secret: string;
|
secret: string;
|
||||||
};
|
};
|
||||||
export type ApiKeyUpdateDto = {
|
export type ApiKeyUpdateDto = {
|
||||||
name: string;
|
name?: string;
|
||||||
permissions: Permission[];
|
permissions?: Permission[];
|
||||||
};
|
};
|
||||||
export type AssetBulkDeleteDto = {
|
export type AssetBulkDeleteDto = {
|
||||||
force?: boolean;
|
force?: boolean;
|
||||||
|
@ -15,14 +15,16 @@ export class APIKeyCreateDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class APIKeyUpdateDto {
|
export class APIKeyUpdateDto {
|
||||||
|
@Optional()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
name!: string;
|
name?: string;
|
||||||
|
|
||||||
|
@Optional()
|
||||||
@IsEnum(Permission, { each: true })
|
@IsEnum(Permission, { each: true })
|
||||||
@ApiProperty({ enum: Permission, enumName: 'Permission', isArray: true })
|
@ApiProperty({ enum: Permission, enumName: 'Permission', isArray: true })
|
||||||
@ArrayMinSize(1)
|
@ArrayMinSize(1)
|
||||||
permissions!: Permission[];
|
permissions?: Permission[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class APIKeyCreateResponseDto {
|
export class APIKeyCreateResponseDto {
|
||||||
|
@ -110,7 +110,13 @@
|
|||||||
Permission.PersonReassign,
|
Permission.PersonReassign,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
permissions.set('session', [Permission.SessionRead, Permission.SessionUpdate, Permission.SessionDelete]);
|
permissions.set('session', [
|
||||||
|
Permission.SessionCreate,
|
||||||
|
Permission.SessionRead,
|
||||||
|
Permission.SessionUpdate,
|
||||||
|
Permission.SessionDelete,
|
||||||
|
Permission.SessionLock,
|
||||||
|
]);
|
||||||
|
|
||||||
permissions.set('sharedLink', [
|
permissions.set('sharedLink', [
|
||||||
Permission.SharedLinkCreate,
|
Permission.SharedLinkCreate,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user