rename new API field to albumUsers

This commit is contained in:
mgabor
2024-04-19 20:07:53 +02:00
parent 3d528f0840
commit 4960477627
14 changed files with 85 additions and 63 deletions

View File

@@ -16,6 +16,8 @@ doc/AddUsersDto.md
doc/AlbumApi.md
doc/AlbumCountResponseDto.md
doc/AlbumResponseDto.md
doc/AlbumUserResponseDto.md
doc/AlbumUserRole.md
doc/AllJobStatusResponseDto.md
doc/AssetApi.md
doc/AssetBulkDeleteDto.md
@@ -185,6 +187,7 @@ doc/TranscodeHWAccel.md
doc/TranscodePolicy.md
doc/TrashApi.md
doc/UpdateAlbumDto.md
doc/UpdateAlbumUserDto.md
doc/UpdateAssetDto.md
doc/UpdateLibraryDto.md
doc/UpdatePartnerDto.md
@@ -242,6 +245,8 @@ lib/model/activity_statistics_response_dto.dart
lib/model/add_users_dto.dart
lib/model/album_count_response_dto.dart
lib/model/album_response_dto.dart
lib/model/album_user_response_dto.dart
lib/model/album_user_role.dart
lib/model/all_job_status_response_dto.dart
lib/model/api_key_create_dto.dart
lib/model/api_key_create_response_dto.dart
@@ -395,6 +400,7 @@ lib/model/tone_mapping.dart
lib/model/transcode_hw_accel.dart
lib/model/transcode_policy.dart
lib/model/update_album_dto.dart
lib/model/update_album_user_dto.dart
lib/model/update_asset_dto.dart
lib/model/update_library_dto.dart
lib/model/update_partner_dto.dart
@@ -420,6 +426,8 @@ test/add_users_dto_test.dart
test/album_api_test.dart
test/album_count_response_dto_test.dart
test/album_response_dto_test.dart
test/album_user_response_dto_test.dart
test/album_user_role_test.dart
test/all_job_status_response_dto_test.dart
test/api_key_api_test.dart
test/api_key_create_dto_test.dart
@@ -594,6 +602,7 @@ test/transcode_hw_accel_test.dart
test/transcode_policy_test.dart
test/trash_api_test.dart
test/update_album_dto_test.dart
test/update_album_user_dto_test.dart
test/update_asset_dto_test.dart
test/update_library_dto_test.dart
test/update_partner_dto_test.dart

View File

@@ -91,6 +91,7 @@ Class | Method | HTTP request | Description
*AlbumApi* | [**removeAssetFromAlbum**](doc//AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets |
*AlbumApi* | [**removeUserFromAlbum**](doc//AlbumApi.md#removeuserfromalbum) | **DELETE** /album/{id}/user/{userId} |
*AlbumApi* | [**updateAlbumInfo**](doc//AlbumApi.md#updatealbuminfo) | **PATCH** /album/{id} |
*AlbumApi* | [**updateAlbumUser**](doc//AlbumApi.md#updatealbumuser) | **PUT** /album/{id}/permission/{userId} |
*AssetApi* | [**checkBulkUpload**](doc//AssetApi.md#checkbulkupload) | **POST** /asset/bulk-upload-check |
*AssetApi* | [**checkExistingAssets**](doc//AssetApi.md#checkexistingassets) | **POST** /asset/exist |
*AssetApi* | [**deleteAssets**](doc//AssetApi.md#deleteassets) | **DELETE** /asset |
@@ -235,6 +236,8 @@ Class | Method | HTTP request | Description
- [AddUsersDto](doc//AddUsersDto.md)
- [AlbumCountResponseDto](doc//AlbumCountResponseDto.md)
- [AlbumResponseDto](doc//AlbumResponseDto.md)
- [AlbumUserResponseDto](doc//AlbumUserResponseDto.md)
- [AlbumUserRole](doc//AlbumUserRole.md)
- [AllJobStatusResponseDto](doc//AllJobStatusResponseDto.md)
- [AssetBulkDeleteDto](doc//AssetBulkDeleteDto.md)
- [AssetBulkUpdateDto](doc//AssetBulkUpdateDto.md)
@@ -384,6 +387,7 @@ Class | Method | HTTP request | Description
- [TranscodeHWAccel](doc//TranscodeHWAccel.md)
- [TranscodePolicy](doc//TranscodePolicy.md)
- [UpdateAlbumDto](doc//UpdateAlbumDto.md)
- [UpdateAlbumUserDto](doc//UpdateAlbumUserDto.md)
- [UpdateAssetDto](doc//UpdateAssetDto.md)
- [UpdateLibraryDto](doc//UpdateLibraryDto.md)
- [UpdatePartnerDto](doc//UpdatePartnerDto.md)

View File

@@ -10,6 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**albumName** | **String** | |
**albumThumbnailAssetId** | **String** | |
**albumUsers** | [**List<AlbumUserResponseDto>**](AlbumUserResponseDto.md) | | [default to const []]
**assetCount** | **int** | |
**assets** | [**List<AssetResponseDto>**](AssetResponseDto.md) | | [default to const []]
**createdAt** | [**DateTime**](DateTime.md) | |
@@ -23,8 +24,7 @@ Name | Type | Description | Notes
**owner** | [**UserResponseDto**](UserResponseDto.md) | |
**ownerId** | **String** | |
**shared** | **bool** | |
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | Deprecated in favor of sharedUsersV2 | [default to const []]
**sharedUsersV2** | [**List<AlbumUserResponseDto>**](AlbumUserResponseDto.md) | | [default to const []]
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | Deprecated in favor of albumUsers | [default to const []]
**startDate** | [**DateTime**](DateTime.md) | | [optional]
**updatedAt** | [**DateTime**](DateTime.md) | |

View File

@@ -64,6 +64,8 @@ part 'model/activity_statistics_response_dto.dart';
part 'model/add_users_dto.dart';
part 'model/album_count_response_dto.dart';
part 'model/album_response_dto.dart';
part 'model/album_user_response_dto.dart';
part 'model/album_user_role.dart';
part 'model/all_job_status_response_dto.dart';
part 'model/asset_bulk_delete_dto.dart';
part 'model/asset_bulk_update_dto.dart';
@@ -213,6 +215,7 @@ part 'model/tone_mapping.dart';
part 'model/transcode_hw_accel.dart';
part 'model/transcode_policy.dart';
part 'model/update_album_dto.dart';
part 'model/update_album_user_dto.dart';
part 'model/update_asset_dto.dart';
part 'model/update_library_dto.dart';
part 'model/update_partner_dto.dart';

View File

@@ -202,6 +202,10 @@ class ApiClient {
return AlbumCountResponseDto.fromJson(value);
case 'AlbumResponseDto':
return AlbumResponseDto.fromJson(value);
case 'AlbumUserResponseDto':
return AlbumUserResponseDto.fromJson(value);
case 'AlbumUserRole':
return AlbumUserRoleTypeTransformer().decode(value);
case 'AllJobStatusResponseDto':
return AllJobStatusResponseDto.fromJson(value);
case 'AssetBulkDeleteDto':
@@ -500,6 +504,8 @@ class ApiClient {
return TranscodePolicyTypeTransformer().decode(value);
case 'UpdateAlbumDto':
return UpdateAlbumDto.fromJson(value);
case 'UpdateAlbumUserDto':
return UpdateAlbumUserDto.fromJson(value);
case 'UpdateAssetDto':
return UpdateAssetDto.fromJson(value);
case 'UpdateLibraryDto':

View File

@@ -15,6 +15,7 @@ class AlbumResponseDto {
AlbumResponseDto({
required this.albumName,
required this.albumThumbnailAssetId,
this.albumUsers = const [],
required this.assetCount,
this.assets = const [],
required this.createdAt,
@@ -29,7 +30,6 @@ class AlbumResponseDto {
required this.ownerId,
required this.shared,
this.sharedUsers = const [],
this.sharedUsersV2 = const [],
this.startDate,
required this.updatedAt,
});
@@ -38,6 +38,8 @@ class AlbumResponseDto {
String? albumThumbnailAssetId;
List<AlbumUserResponseDto> albumUsers;
int assetCount;
List<AssetResponseDto> assets;
@@ -82,11 +84,9 @@ class AlbumResponseDto {
bool shared;
/// Deprecated in favor of sharedUsersV2
/// Deprecated in favor of albumUsers
List<UserResponseDto> sharedUsers;
List<AlbumUserResponseDto> sharedUsersV2;
///
/// 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
@@ -101,6 +101,7 @@ class AlbumResponseDto {
bool operator ==(Object other) => identical(this, other) || other is AlbumResponseDto &&
other.albumName == albumName &&
other.albumThumbnailAssetId == albumThumbnailAssetId &&
_deepEquality.equals(other.albumUsers, albumUsers) &&
other.assetCount == assetCount &&
_deepEquality.equals(other.assets, assets) &&
other.createdAt == createdAt &&
@@ -115,7 +116,6 @@ class AlbumResponseDto {
other.ownerId == ownerId &&
other.shared == shared &&
_deepEquality.equals(other.sharedUsers, sharedUsers) &&
_deepEquality.equals(other.sharedUsersV2, sharedUsersV2) &&
other.startDate == startDate &&
other.updatedAt == updatedAt;
@@ -124,6 +124,7 @@ class AlbumResponseDto {
// ignore: unnecessary_parenthesis
(albumName.hashCode) +
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) +
(albumUsers.hashCode) +
(assetCount.hashCode) +
(assets.hashCode) +
(createdAt.hashCode) +
@@ -138,12 +139,11 @@ class AlbumResponseDto {
(ownerId.hashCode) +
(shared.hashCode) +
(sharedUsers.hashCode) +
(sharedUsersV2.hashCode) +
(startDate == null ? 0 : startDate!.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, assetCount=$assetCount, assets=$assets, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, owner=$owner, ownerId=$ownerId, shared=$shared, sharedUsers=$sharedUsers, sharedUsersV2=$sharedUsersV2, startDate=$startDate, updatedAt=$updatedAt]';
String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, albumUsers=$albumUsers, assetCount=$assetCount, assets=$assets, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, owner=$owner, ownerId=$ownerId, shared=$shared, sharedUsers=$sharedUsers, startDate=$startDate, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -153,6 +153,7 @@ class AlbumResponseDto {
} else {
// json[r'albumThumbnailAssetId'] = null;
}
json[r'albumUsers'] = this.albumUsers;
json[r'assetCount'] = this.assetCount;
json[r'assets'] = this.assets;
json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
@@ -179,7 +180,6 @@ class AlbumResponseDto {
json[r'ownerId'] = this.ownerId;
json[r'shared'] = this.shared;
json[r'sharedUsers'] = this.sharedUsers;
json[r'sharedUsersV2'] = this.sharedUsersV2;
if (this.startDate != null) {
json[r'startDate'] = this.startDate!.toUtc().toIso8601String();
} else {
@@ -199,6 +199,7 @@ class AlbumResponseDto {
return AlbumResponseDto(
albumName: mapValueOfType<String>(json, r'albumName')!,
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
albumUsers: AlbumUserResponseDto.listFromJson(json[r'albumUsers']),
assetCount: mapValueOfType<int>(json, r'assetCount')!,
assets: AssetResponseDto.listFromJson(json[r'assets']),
createdAt: mapDateTime(json, r'createdAt', r'')!,
@@ -213,7 +214,6 @@ class AlbumResponseDto {
ownerId: mapValueOfType<String>(json, r'ownerId')!,
shared: mapValueOfType<bool>(json, r'shared')!,
sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']),
sharedUsersV2: AlbumUserResponseDto.listFromJson(json[r'sharedUsersV2']),
startDate: mapDateTime(json, r'startDate', r''),
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);
@@ -265,6 +265,7 @@ class AlbumResponseDto {
static const requiredKeys = <String>{
'albumName',
'albumThumbnailAssetId',
'albumUsers',
'assetCount',
'assets',
'createdAt',
@@ -276,7 +277,6 @@ class AlbumResponseDto {
'ownerId',
'shared',
'sharedUsers',
'sharedUsersV2',
'updatedAt',
};
}

View File

@@ -26,6 +26,11 @@ void main() {
// TODO
});
// List<AlbumUserResponseDto> albumUsers (default value: const [])
test('to test the property `albumUsers`', () async {
// TODO
});
// int assetCount
test('to test the property `assetCount`', () async {
// TODO
@@ -91,17 +96,12 @@ void main() {
// TODO
});
// Deprecated in favor of sharedUsersV2
// Deprecated in favor of albumUsers
// List<UserResponseDto> sharedUsers (default value: const [])
test('to test the property `sharedUsers`', () async {
// TODO
});
// List<AlbumUserResponseDto> sharedUsersV2 (default value: const [])
test('to test the property `sharedUsersV2`', () async {
// TODO
});
// DateTime startDate
test('to test the property `startDate`', () async {
// TODO

View File

@@ -7261,6 +7261,12 @@
"nullable": true,
"type": "string"
},
"albumUsers": {
"items": {
"$ref": "#/components/schemas/AlbumUserResponseDto"
},
"type": "array"
},
"assetCount": {
"type": "integer"
},
@@ -7308,18 +7314,12 @@
},
"sharedUsers": {
"deprecated": true,
"description": "Deprecated in favor of sharedUsersV2",
"description": "Deprecated in favor of albumUsers",
"items": {
"$ref": "#/components/schemas/UserResponseDto"
},
"type": "array"
},
"sharedUsersV2": {
"items": {
"$ref": "#/components/schemas/AlbumUserResponseDto"
},
"type": "array"
},
"startDate": {
"format": "date-time",
"type": "string"
@@ -7332,6 +7332,7 @@
"required": [
"albumName",
"albumThumbnailAssetId",
"albumUsers",
"assetCount",
"assets",
"createdAt",
@@ -7343,7 +7344,6 @@
"ownerId",
"shared",
"sharedUsers",
"sharedUsersV2",
"updatedAt"
],
"type": "object"

View File

@@ -38,6 +38,28 @@ export type ActivityCreateDto = {
export type ActivityStatisticsResponseDto = {
comments: number;
};
export type UserResponseDto = {
avatarColor: UserAvatarColor;
createdAt: string;
deletedAt: string | null;
email: string;
id: string;
isAdmin: boolean;
memoriesEnabled?: boolean;
name: string;
oauthId: string;
profileImagePath: string;
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
export type AlbumUserResponseDto = {
role: AlbumUserRole;
user: UserResponseDto;
};
export type ExifResponseDto = {
city?: string | null;
country?: string | null;
@@ -61,24 +83,6 @@ export type ExifResponseDto = {
state?: string | null;
timeZone?: string | null;
};
export type UserResponseDto = {
avatarColor: UserAvatarColor;
createdAt: string;
deletedAt: string | null;
email: string;
id: string;
isAdmin: boolean;
memoriesEnabled?: boolean;
name: string;
oauthId: string;
profileImagePath: string;
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
export type AssetFaceWithoutPersonResponseDto = {
boundingBoxX1: number;
boundingBoxX2: number;
@@ -141,13 +145,10 @@ export type AssetResponseDto = {
"type": AssetTypeEnum;
updatedAt: string;
};
export type AlbumUserResponseDto = {
role: AlbumUserRole;
user: UserResponseDto;
};
export type AlbumResponseDto = {
albumName: string;
albumThumbnailAssetId: string | null;
albumUsers: AlbumUserResponseDto[];
assetCount: number;
assets: AssetResponseDto[];
createdAt: string;
@@ -161,9 +162,8 @@ export type AlbumResponseDto = {
owner: UserResponseDto;
ownerId: string;
shared: boolean;
/** Deprecated in favor of sharedUsersV2 */
/** Deprecated in favor of albumUsers */
sharedUsers: UserResponseDto[];
sharedUsersV2: AlbumUserResponseDto[];
startDate?: string;
updatedAt: string;
};
@@ -2920,6 +2920,10 @@ export enum UserAvatarColor {
Gray = "gray",
Amber = "amber"
}
export enum AlbumUserRole {
Editor = "editor",
Viewer = "viewer"
}
export enum UserStatus {
Active = "active",
Removing = "removing",
@@ -2940,10 +2944,6 @@ export enum AssetOrder {
Asc = "asc",
Desc = "desc"
}
export enum AlbumUserRole {
Editor = "editor",
Viewer = "viewer"
}
export enum Error {
Duplicate = "duplicate",
NoPermission = "no_permission",

View File

@@ -105,9 +105,9 @@ export class AlbumResponseDto {
updatedAt!: Date;
albumThumbnailAssetId!: string | null;
shared!: boolean;
@ApiProperty({ deprecated: true, description: 'Deprecated in favor of sharedUsersV2' })
@ApiProperty({ deprecated: true, description: 'Deprecated in favor of albumUsers' })
sharedUsers!: UserResponseDto[];
sharedUsersV2!: AlbumUserResponseDto[];
albumUsers!: AlbumUserResponseDto[];
hasSharedLink!: boolean;
assets!: AssetResponseDto[];
owner!: UserResponseDto;
@@ -158,7 +158,7 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
ownerId: entity.ownerId,
owner: mapUser(entity.owner),
sharedUsers,
sharedUsersV2,
albumUsers: sharedUsersV2,
shared: hasSharedUser || hasSharedLink,
hasSharedLink,
startDate,

View File

@@ -103,7 +103,7 @@ const albumResponse: AlbumResponseDto = {
ownerId: 'admin_id',
owner: mapUser(userStub.admin),
sharedUsers: [],
sharedUsersV2: [],
albumUsers: [],
shared: false,
hasSharedLink: false,
assets: [],

View File

@@ -99,7 +99,7 @@
<p class="text-sm">Owner</p>
</div>
</div>
{#each album.sharedUsersV2.toSorted((a, b) => {
{#each album.albumUsers.toSorted((a, b) => {
if (a.role === AlbumUserRole.Viewer && b.role === AlbumUserRole.Editor) {
return 1;
}

View File

@@ -137,8 +137,8 @@
$: showActivityStatus =
album.sharedUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0);
$: isEditor = album.sharedUsersV2.find(({ user: { id } }) => id === $user.id)?.role === AlbumUserRole.Editor;
$: albumHasViewers = album.sharedUsersV2.some(({ role }) => role === AlbumUserRole.Viewer);
$: isEditor = album.albumUsers.find(({ user: { id } }) => id === $user.id)?.role === AlbumUserRole.Editor;
$: albumHasViewers = album.albumUsers.some(({ role }) => role === AlbumUserRole.Viewer);
afterNavigate(({ from }) => {
assetViewingStore.showAssetViewer(false);
@@ -585,7 +585,7 @@
</button>
<!-- users with write access (collaborators) -->
{#each album.sharedUsersV2.filter(({ role }) => role === AlbumUserRole.Editor) as { user } (user.id)}
{#each album.albumUsers.filter(({ role }) => role === AlbumUserRole.Editor) as { user } (user.id)}
<button on:click={() => (viewMode = ViewMode.VIEW_USERS)}>
<UserAvatar {user} size="md" />
</button>

View File

@@ -16,7 +16,7 @@ export const albumFactory = Sync.makeFactory<AlbumResponseDto>({
owner: userFactory.build(),
shared: false,
sharedUsers: [],
sharedUsersV2: [],
albumUsers: [],
hasSharedLink: false,
isActivityEnabled: true,
order: AssetOrder.Desc,