diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILES index f83444413e..fd25a026ec 100644 --- a/mobile/openapi/.openapi-generator/FILES +++ b/mobile/openapi/.openapi-generator/FILES @@ -15,8 +15,8 @@ doc/ActivityStatisticsResponseDto.md doc/AddUsersDto.md doc/AlbumApi.md doc/AlbumCountResponseDto.md -doc/AlbumPermissionResponseDto.md doc/AlbumResponseDto.md +doc/AlbumUserResponseDto.md doc/AllJobStatusResponseDto.md doc/AssetApi.md doc/AssetBulkDeleteDto.md @@ -142,7 +142,6 @@ doc/ServerPingResponse.md doc/ServerStatsResponseDto.md doc/ServerThemeDto.md doc/ServerVersionResponseDto.md -doc/SetAlbumPermissionDto.md doc/SharedLinkApi.md doc/SharedLinkCreateDto.md doc/SharedLinkEditDto.md @@ -184,6 +183,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 @@ -238,8 +238,8 @@ lib/model/activity_response_dto.dart lib/model/activity_statistics_response_dto.dart lib/model/add_users_dto.dart lib/model/album_count_response_dto.dart -lib/model/album_permission_response_dto.dart lib/model/album_response_dto.dart +lib/model/album_user_response_dto.dart lib/model/all_job_status_response_dto.dart lib/model/api_key_create_dto.dart lib/model/api_key_create_response_dto.dart @@ -356,7 +356,6 @@ lib/model/server_ping_response.dart lib/model/server_stats_response_dto.dart lib/model/server_theme_dto.dart lib/model/server_version_response_dto.dart -lib/model/set_album_permission_dto.dart lib/model/shared_link_create_dto.dart lib/model/shared_link_edit_dto.dart lib/model/shared_link_response_dto.dart @@ -393,6 +392,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 @@ -417,8 +417,8 @@ test/activity_statistics_response_dto_test.dart test/add_users_dto_test.dart test/album_api_test.dart test/album_count_response_dto_test.dart -test/album_permission_response_dto_test.dart test/album_response_dto_test.dart +test/album_user_response_dto_test.dart test/all_job_status_response_dto_test.dart test/api_key_api_test.dart test/api_key_create_dto_test.dart @@ -549,7 +549,6 @@ test/server_ping_response_test.dart test/server_stats_response_dto_test.dart test/server_theme_dto_test.dart test/server_version_response_dto_test.dart -test/set_album_permission_dto_test.dart test/shared_link_api_test.dart test/shared_link_create_dto_test.dart test/shared_link_edit_dto_test.dart @@ -591,6 +590,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 diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 5c57c7258b..0c130c6b2f 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -90,8 +90,8 @@ Class | Method | HTTP request | Description *AlbumApi* | [**getAllAlbums**](doc//AlbumApi.md#getallalbums) | **GET** /album | *AlbumApi* | [**removeAssetFromAlbum**](doc//AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets | *AlbumApi* | [**removeUserFromAlbum**](doc//AlbumApi.md#removeuserfromalbum) | **DELETE** /album/{id}/user/{userId} | -*AlbumApi* | [**setAlbumPermission**](doc//AlbumApi.md#setalbumpermission) | **PUT** /album/{id}/permission/{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 | @@ -233,8 +233,8 @@ Class | Method | HTTP request | Description - [ActivityStatisticsResponseDto](doc//ActivityStatisticsResponseDto.md) - [AddUsersDto](doc//AddUsersDto.md) - [AlbumCountResponseDto](doc//AlbumCountResponseDto.md) - - [AlbumPermissionResponseDto](doc//AlbumPermissionResponseDto.md) - [AlbumResponseDto](doc//AlbumResponseDto.md) + - [AlbumUserResponseDto](doc//AlbumUserResponseDto.md) - [AllJobStatusResponseDto](doc//AllJobStatusResponseDto.md) - [AssetBulkDeleteDto](doc//AssetBulkDeleteDto.md) - [AssetBulkUpdateDto](doc//AssetBulkUpdateDto.md) @@ -347,7 +347,6 @@ Class | Method | HTTP request | Description - [ServerStatsResponseDto](doc//ServerStatsResponseDto.md) - [ServerThemeDto](doc//ServerThemeDto.md) - [ServerVersionResponseDto](doc//ServerVersionResponseDto.md) - - [SetAlbumPermissionDto](doc//SetAlbumPermissionDto.md) - [SharedLinkCreateDto](doc//SharedLinkCreateDto.md) - [SharedLinkEditDto](doc//SharedLinkEditDto.md) - [SharedLinkResponseDto](doc//SharedLinkResponseDto.md) @@ -384,6 +383,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) diff --git a/mobile/openapi/doc/AlbumApi.md b/mobile/openapi/doc/AlbumApi.md index 02c2651122..396f7514ee 100644 --- a/mobile/openapi/doc/AlbumApi.md +++ b/mobile/openapi/doc/AlbumApi.md @@ -18,8 +18,8 @@ Method | HTTP request | Description [**getAllAlbums**](AlbumApi.md#getallalbums) | **GET** /album | [**removeAssetFromAlbum**](AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets | [**removeUserFromAlbum**](AlbumApi.md#removeuserfromalbum) | **DELETE** /album/{id}/user/{userId} | -[**setAlbumPermission**](AlbumApi.md#setalbumpermission) | **PUT** /album/{id}/permission/{userId} | [**updateAlbumInfo**](AlbumApi.md#updatealbuminfo) | **PATCH** /album/{id} | +[**updateAlbumUser**](AlbumApi.md#updatealbumuser) | **PUT** /album/{id}/permission/{userId} | # **addAssetsToAlbum** @@ -527,64 +527,6 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **setAlbumPermission** -> setAlbumPermission(id, userId, setAlbumPermissionDto) - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: cookie -//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -// TODO Configure HTTP Bearer authorization: bearer -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = AlbumApi(); -final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | -final userId = userId_example; // String | -final setAlbumPermissionDto = SetAlbumPermissionDto(); // SetAlbumPermissionDto | - -try { - api_instance.setAlbumPermission(id, userId, setAlbumPermissionDto); -} catch (e) { - print('Exception when calling AlbumApi->setAlbumPermission: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **id** | **String**| | - **userId** | **String**| | - **setAlbumPermissionDto** | [**SetAlbumPermissionDto**](SetAlbumPermissionDto.md)| | - -### Return type - -void (empty response body) - -### Authorization - -[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updateAlbumInfo** > AlbumResponseDto updateAlbumInfo(id, updateAlbumDto) @@ -642,3 +584,61 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateAlbumUser** +> updateAlbumUser(id, userId, updateAlbumUserDto) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: cookie +//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; +// TODO Configure HTTP Bearer authorization: bearer +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = AlbumApi(); +final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | +final userId = userId_example; // String | +final updateAlbumUserDto = UpdateAlbumUserDto(); // UpdateAlbumUserDto | + +try { + api_instance.updateAlbumUser(id, userId, updateAlbumUserDto); +} catch (e) { + print('Exception when calling AlbumApi->updateAlbumUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| | + **userId** | **String**| | + **updateAlbumUserDto** | [**UpdateAlbumUserDto**](UpdateAlbumUserDto.md)| | + +### Return type + +void (empty response body) + +### Authorization + +[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/mobile/openapi/doc/AlbumResponseDto.md b/mobile/openapi/doc/AlbumResponseDto.md index 1f6e4d2d65..3d94c0e65f 100644 --- a/mobile/openapi/doc/AlbumResponseDto.md +++ b/mobile/openapi/doc/AlbumResponseDto.md @@ -9,7 +9,6 @@ import 'package:openapi/api.dart'; Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **albumName** | **String** | | -**albumPermissions** | [**List**](AlbumPermissionResponseDto.md) | | [default to const []] **albumThumbnailAssetId** | **String** | | **assetCount** | **int** | | **assets** | [**List**](AssetResponseDto.md) | | [default to const []] @@ -24,7 +23,8 @@ Name | Type | Description | Notes **owner** | [**UserResponseDto**](UserResponseDto.md) | | **ownerId** | **String** | | **shared** | **bool** | | -**sharedUsers** | [**List**](UserResponseDto.md) | Deprecated in favor of albumPermissions | [default to const []] +**sharedUsers** | [**List**](UserResponseDto.md) | Deprecated in favor of users | [default to const []] +**sharedUsersV2** | [**List**](AlbumUserResponseDto.md) | | [default to const []] **startDate** | [**DateTime**](DateTime.md) | | [optional] **updatedAt** | [**DateTime**](DateTime.md) | | diff --git a/mobile/openapi/doc/AlbumPermissionResponseDto.md b/mobile/openapi/doc/AlbumUserResponseDto.md similarity index 91% rename from mobile/openapi/doc/AlbumPermissionResponseDto.md rename to mobile/openapi/doc/AlbumUserResponseDto.md index b8c5e531a7..415128aa4f 100644 --- a/mobile/openapi/doc/AlbumPermissionResponseDto.md +++ b/mobile/openapi/doc/AlbumUserResponseDto.md @@ -1,4 +1,4 @@ -# openapi.model.AlbumPermissionResponseDto +# openapi.model.AlbumUserResponseDto ## Load the model package ```dart diff --git a/mobile/openapi/doc/SetAlbumPermissionDto.md b/mobile/openapi/doc/UpdateAlbumUserDto.md similarity index 90% rename from mobile/openapi/doc/SetAlbumPermissionDto.md rename to mobile/openapi/doc/UpdateAlbumUserDto.md index d15312ba04..a2e1b3c745 100644 --- a/mobile/openapi/doc/SetAlbumPermissionDto.md +++ b/mobile/openapi/doc/UpdateAlbumUserDto.md @@ -1,4 +1,4 @@ -# openapi.model.SetAlbumPermissionDto +# openapi.model.UpdateAlbumUserDto ## Load the model package ```dart diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 7d4cb5086f..72927349af 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -61,8 +61,8 @@ part 'model/activity_response_dto.dart'; part 'model/activity_statistics_response_dto.dart'; part 'model/add_users_dto.dart'; part 'model/album_count_response_dto.dart'; -part 'model/album_permission_response_dto.dart'; part 'model/album_response_dto.dart'; +part 'model/album_user_response_dto.dart'; part 'model/all_job_status_response_dto.dart'; part 'model/asset_bulk_delete_dto.dart'; part 'model/asset_bulk_update_dto.dart'; @@ -175,7 +175,6 @@ part 'model/server_ping_response.dart'; part 'model/server_stats_response_dto.dart'; part 'model/server_theme_dto.dart'; part 'model/server_version_response_dto.dart'; -part 'model/set_album_permission_dto.dart'; part 'model/shared_link_create_dto.dart'; part 'model/shared_link_edit_dto.dart'; part 'model/shared_link_response_dto.dart'; @@ -212,6 +211,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'; diff --git a/mobile/openapi/lib/api/album_api.dart b/mobile/openapi/lib/api/album_api.dart index 49b0fde873..1e1f90ab0f 100644 --- a/mobile/openapi/lib/api/album_api.dart +++ b/mobile/openapi/lib/api/album_api.dart @@ -485,55 +485,6 @@ class AlbumApi { } } - /// Performs an HTTP 'PUT /album/{id}/permission/{userId}' operation and returns the [Response]. - /// Parameters: - /// - /// * [String] id (required): - /// - /// * [String] userId (required): - /// - /// * [SetAlbumPermissionDto] setAlbumPermissionDto (required): - Future setAlbumPermissionWithHttpInfo(String id, String userId, SetAlbumPermissionDto setAlbumPermissionDto,) async { - // ignore: prefer_const_declarations - final path = r'/album/{id}/permission/{userId}' - .replaceAll('{id}', id) - .replaceAll('{userId}', userId); - - // ignore: prefer_final_locals - Object? postBody = setAlbumPermissionDto; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const contentTypes = ['application/json']; - - - return apiClient.invokeAPI( - path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes.first, - ); - } - - /// Parameters: - /// - /// * [String] id (required): - /// - /// * [String] userId (required): - /// - /// * [SetAlbumPermissionDto] setAlbumPermissionDto (required): - Future setAlbumPermission(String id, String userId, SetAlbumPermissionDto setAlbumPermissionDto,) async { - final response = await setAlbumPermissionWithHttpInfo(id, userId, setAlbumPermissionDto,); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - } - /// Performs an HTTP 'PATCH /album/{id}' operation and returns the [Response]. /// Parameters: /// @@ -585,4 +536,53 @@ class AlbumApi { } return null; } + + /// Performs an HTTP 'PUT /album/{id}/permission/{userId}' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] id (required): + /// + /// * [String] userId (required): + /// + /// * [UpdateAlbumUserDto] updateAlbumUserDto (required): + Future updateAlbumUserWithHttpInfo(String id, String userId, UpdateAlbumUserDto updateAlbumUserDto,) async { + // ignore: prefer_const_declarations + final path = r'/album/{id}/permission/{userId}' + .replaceAll('{id}', id) + .replaceAll('{userId}', userId); + + // ignore: prefer_final_locals + Object? postBody = updateAlbumUserDto; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] id (required): + /// + /// * [String] userId (required): + /// + /// * [UpdateAlbumUserDto] updateAlbumUserDto (required): + Future updateAlbumUser(String id, String userId, UpdateAlbumUserDto updateAlbumUserDto,) async { + final response = await updateAlbumUserWithHttpInfo(id, userId, updateAlbumUserDto,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } } diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 0d318333f4..502a6d9096 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -200,10 +200,10 @@ class ApiClient { return AddUsersDto.fromJson(value); case 'AlbumCountResponseDto': return AlbumCountResponseDto.fromJson(value); - case 'AlbumPermissionResponseDto': - return AlbumPermissionResponseDto.fromJson(value); case 'AlbumResponseDto': return AlbumResponseDto.fromJson(value); + case 'AlbumUserResponseDto': + return AlbumUserResponseDto.fromJson(value); case 'AllJobStatusResponseDto': return AllJobStatusResponseDto.fromJson(value); case 'AssetBulkDeleteDto': @@ -428,8 +428,6 @@ class ApiClient { return ServerThemeDto.fromJson(value); case 'ServerVersionResponseDto': return ServerVersionResponseDto.fromJson(value); - case 'SetAlbumPermissionDto': - return SetAlbumPermissionDto.fromJson(value); case 'SharedLinkCreateDto': return SharedLinkCreateDto.fromJson(value); case 'SharedLinkEditDto': @@ -502,6 +500,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': diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index 890cf4c008..18b11a3035 100644 --- a/mobile/openapi/lib/model/album_response_dto.dart +++ b/mobile/openapi/lib/model/album_response_dto.dart @@ -14,7 +14,6 @@ class AlbumResponseDto { /// Returns a new [AlbumResponseDto] instance. AlbumResponseDto({ required this.albumName, - this.albumPermissions = const [], required this.albumThumbnailAssetId, required this.assetCount, this.assets = const [], @@ -30,14 +29,13 @@ class AlbumResponseDto { required this.ownerId, required this.shared, this.sharedUsers = const [], + this.sharedUsersV2 = const [], this.startDate, required this.updatedAt, }); String albumName; - List albumPermissions; - String? albumThumbnailAssetId; int assetCount; @@ -84,9 +82,11 @@ class AlbumResponseDto { bool shared; - /// Deprecated in favor of albumPermissions + /// Deprecated in favor of users List sharedUsers; + List 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 @@ -100,7 +100,6 @@ class AlbumResponseDto { @override bool operator ==(Object other) => identical(this, other) || other is AlbumResponseDto && other.albumName == albumName && - _deepEquality.equals(other.albumPermissions, albumPermissions) && other.albumThumbnailAssetId == albumThumbnailAssetId && other.assetCount == assetCount && _deepEquality.equals(other.assets, assets) && @@ -116,6 +115,7 @@ class AlbumResponseDto { other.ownerId == ownerId && other.shared == shared && _deepEquality.equals(other.sharedUsers, sharedUsers) && + _deepEquality.equals(other.sharedUsersV2, sharedUsersV2) && other.startDate == startDate && other.updatedAt == updatedAt; @@ -123,7 +123,6 @@ class AlbumResponseDto { int get hashCode => // ignore: unnecessary_parenthesis (albumName.hashCode) + - (albumPermissions.hashCode) + (albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) + (assetCount.hashCode) + (assets.hashCode) + @@ -139,16 +138,16 @@ class AlbumResponseDto { (ownerId.hashCode) + (shared.hashCode) + (sharedUsers.hashCode) + + (sharedUsersV2.hashCode) + (startDate == null ? 0 : startDate!.hashCode) + (updatedAt.hashCode); @override - String toString() => 'AlbumResponseDto[albumName=$albumName, albumPermissions=$albumPermissions, 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, startDate=$startDate, updatedAt=$updatedAt]'; + 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]'; Map toJson() { final json = {}; json[r'albumName'] = this.albumName; - json[r'albumPermissions'] = this.albumPermissions; if (this.albumThumbnailAssetId != null) { json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId; } else { @@ -180,6 +179,7 @@ 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 { @@ -198,7 +198,6 @@ class AlbumResponseDto { return AlbumResponseDto( albumName: mapValueOfType(json, r'albumName')!, - albumPermissions: AlbumPermissionResponseDto.listFromJson(json[r'albumPermissions']), albumThumbnailAssetId: mapValueOfType(json, r'albumThumbnailAssetId'), assetCount: mapValueOfType(json, r'assetCount')!, assets: AssetResponseDto.listFromJson(json[r'assets']), @@ -214,6 +213,7 @@ class AlbumResponseDto { ownerId: mapValueOfType(json, r'ownerId')!, shared: mapValueOfType(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'')!, ); @@ -264,7 +264,6 @@ class AlbumResponseDto { /// The list of required keys that must be present in a JSON. static const requiredKeys = { 'albumName', - 'albumPermissions', 'albumThumbnailAssetId', 'assetCount', 'assets', @@ -277,6 +276,7 @@ class AlbumResponseDto { 'ownerId', 'shared', 'sharedUsers', + 'sharedUsersV2', 'updatedAt', }; } diff --git a/mobile/openapi/lib/model/album_permission_response_dto.dart b/mobile/openapi/lib/model/album_user_response_dto.dart similarity index 61% rename from mobile/openapi/lib/model/album_permission_response_dto.dart rename to mobile/openapi/lib/model/album_user_response_dto.dart index 6c33ab7f74..338f8a0762 100644 --- a/mobile/openapi/lib/model/album_permission_response_dto.dart +++ b/mobile/openapi/lib/model/album_user_response_dto.dart @@ -10,9 +10,9 @@ part of openapi.api; -class AlbumPermissionResponseDto { - /// Returns a new [AlbumPermissionResponseDto] instance. - AlbumPermissionResponseDto({ +class AlbumUserResponseDto { + /// Returns a new [AlbumUserResponseDto] instance. + AlbumUserResponseDto({ required this.readonly, required this.user, }); @@ -22,7 +22,7 @@ class AlbumPermissionResponseDto { UserResponseDto user; @override - bool operator ==(Object other) => identical(this, other) || other is AlbumPermissionResponseDto && + bool operator ==(Object other) => identical(this, other) || other is AlbumUserResponseDto && other.readonly == readonly && other.user == user; @@ -33,7 +33,7 @@ class AlbumPermissionResponseDto { (user.hashCode); @override - String toString() => 'AlbumPermissionResponseDto[readonly=$readonly, user=$user]'; + String toString() => 'AlbumUserResponseDto[readonly=$readonly, user=$user]'; Map toJson() { final json = {}; @@ -42,14 +42,14 @@ class AlbumPermissionResponseDto { return json; } - /// Returns a new [AlbumPermissionResponseDto] instance and imports its values from + /// Returns a new [AlbumUserResponseDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static AlbumPermissionResponseDto? fromJson(dynamic value) { + static AlbumUserResponseDto? fromJson(dynamic value) { if (value is Map) { final json = value.cast(); - return AlbumPermissionResponseDto( + return AlbumUserResponseDto( readonly: mapValueOfType(json, r'readonly')!, user: UserResponseDto.fromJson(json[r'user'])!, ); @@ -57,11 +57,11 @@ class AlbumPermissionResponseDto { return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = AlbumPermissionResponseDto.fromJson(row); + final value = AlbumUserResponseDto.fromJson(row); if (value != null) { result.add(value); } @@ -70,12 +70,12 @@ class AlbumPermissionResponseDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = AlbumPermissionResponseDto.fromJson(entry.value); + final value = AlbumUserResponseDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -84,14 +84,14 @@ class AlbumPermissionResponseDto { return map; } - // maps a json object with a list of AlbumPermissionResponseDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of AlbumUserResponseDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = AlbumPermissionResponseDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = AlbumUserResponseDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mobile/openapi/lib/model/set_album_permission_dto.dart b/mobile/openapi/lib/model/update_album_user_dto.dart similarity index 61% rename from mobile/openapi/lib/model/set_album_permission_dto.dart rename to mobile/openapi/lib/model/update_album_user_dto.dart index 64156f72d1..4a86f1dc0f 100644 --- a/mobile/openapi/lib/model/set_album_permission_dto.dart +++ b/mobile/openapi/lib/model/update_album_user_dto.dart @@ -10,16 +10,16 @@ part of openapi.api; -class SetAlbumPermissionDto { - /// Returns a new [SetAlbumPermissionDto] instance. - SetAlbumPermissionDto({ +class UpdateAlbumUserDto { + /// Returns a new [UpdateAlbumUserDto] instance. + UpdateAlbumUserDto({ required this.readonly, }); bool readonly; @override - bool operator ==(Object other) => identical(this, other) || other is SetAlbumPermissionDto && + bool operator ==(Object other) => identical(this, other) || other is UpdateAlbumUserDto && other.readonly == readonly; @override @@ -28,7 +28,7 @@ class SetAlbumPermissionDto { (readonly.hashCode); @override - String toString() => 'SetAlbumPermissionDto[readonly=$readonly]'; + String toString() => 'UpdateAlbumUserDto[readonly=$readonly]'; Map toJson() { final json = {}; @@ -36,25 +36,25 @@ class SetAlbumPermissionDto { return json; } - /// Returns a new [SetAlbumPermissionDto] instance and imports its values from + /// Returns a new [UpdateAlbumUserDto] instance and imports its values from /// [value] if it's a [Map], null otherwise. // ignore: prefer_constructors_over_static_methods - static SetAlbumPermissionDto? fromJson(dynamic value) { + static UpdateAlbumUserDto? fromJson(dynamic value) { if (value is Map) { final json = value.cast(); - return SetAlbumPermissionDto( + return UpdateAlbumUserDto( readonly: mapValueOfType(json, r'readonly')!, ); } return null; } - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; if (json is List && json.isNotEmpty) { for (final row in json) { - final value = SetAlbumPermissionDto.fromJson(row); + final value = UpdateAlbumUserDto.fromJson(row); if (value != null) { result.add(value); } @@ -63,12 +63,12 @@ class SetAlbumPermissionDto { return result.toList(growable: growable); } - static Map mapFromJson(dynamic json) { - final map = {}; + static Map mapFromJson(dynamic json) { + final map = {}; if (json is Map && json.isNotEmpty) { json = json.cast(); // ignore: parameter_assignments for (final entry in json.entries) { - final value = SetAlbumPermissionDto.fromJson(entry.value); + final value = UpdateAlbumUserDto.fromJson(entry.value); if (value != null) { map[entry.key] = value; } @@ -77,14 +77,14 @@ class SetAlbumPermissionDto { return map; } - // maps a json object with a list of SetAlbumPermissionDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; + // maps a json object with a list of UpdateAlbumUserDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; if (json is Map && json.isNotEmpty) { // ignore: parameter_assignments json = json.cast(); for (final entry in json.entries) { - map[entry.key] = SetAlbumPermissionDto.listFromJson(entry.value, growable: growable,); + map[entry.key] = UpdateAlbumUserDto.listFromJson(entry.value, growable: growable,); } } return map; diff --git a/mobile/openapi/test/album_api_test.dart b/mobile/openapi/test/album_api_test.dart index 8c0e5803f5..1a6d3ab3bb 100644 --- a/mobile/openapi/test/album_api_test.dart +++ b/mobile/openapi/test/album_api_test.dart @@ -62,15 +62,15 @@ void main() { // TODO }); - //Future setAlbumPermission(String id, String userId, SetAlbumPermissionDto setAlbumPermissionDto) async - test('test setAlbumPermission', () async { - // TODO - }); - //Future updateAlbumInfo(String id, UpdateAlbumDto updateAlbumDto) async test('test updateAlbumInfo', () async { // TODO }); + //Future updateAlbumUser(String id, String userId, UpdateAlbumUserDto updateAlbumUserDto) async + test('test updateAlbumUser', () async { + // TODO + }); + }); } diff --git a/mobile/openapi/test/album_response_dto_test.dart b/mobile/openapi/test/album_response_dto_test.dart index 7426a6d84d..e18db6ad07 100644 --- a/mobile/openapi/test/album_response_dto_test.dart +++ b/mobile/openapi/test/album_response_dto_test.dart @@ -21,11 +21,6 @@ void main() { // TODO }); - // List albumPermissions (default value: const []) - test('to test the property `albumPermissions`', () async { - // TODO - }); - // String albumThumbnailAssetId test('to test the property `albumThumbnailAssetId`', () async { // TODO @@ -96,12 +91,17 @@ void main() { // TODO }); - // Deprecated in favor of albumPermissions + // Deprecated in favor of users // List sharedUsers (default value: const []) test('to test the property `sharedUsers`', () async { // TODO }); + // List sharedUsersV2 (default value: const []) + test('to test the property `sharedUsersV2`', () async { + // TODO + }); + // DateTime startDate test('to test the property `startDate`', () async { // TODO diff --git a/mobile/openapi/test/album_permission_response_dto_test.dart b/mobile/openapi/test/album_user_response_dto_test.dart similarity index 80% rename from mobile/openapi/test/album_permission_response_dto_test.dart rename to mobile/openapi/test/album_user_response_dto_test.dart index b56ce52b14..e12b6ea60c 100644 --- a/mobile/openapi/test/album_permission_response_dto_test.dart +++ b/mobile/openapi/test/album_user_response_dto_test.dart @@ -11,11 +11,11 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; -// tests for AlbumPermissionResponseDto +// tests for AlbumUserResponseDto void main() { - // final instance = AlbumPermissionResponseDto(); + // final instance = AlbumUserResponseDto(); - group('test AlbumPermissionResponseDto', () { + group('test AlbumUserResponseDto', () { // bool readonly test('to test the property `readonly`', () async { // TODO diff --git a/mobile/openapi/test/set_album_permission_dto_test.dart b/mobile/openapi/test/update_album_user_dto_test.dart similarity index 78% rename from mobile/openapi/test/set_album_permission_dto_test.dart rename to mobile/openapi/test/update_album_user_dto_test.dart index caac924da7..13ba7632f7 100644 --- a/mobile/openapi/test/set_album_permission_dto_test.dart +++ b/mobile/openapi/test/update_album_user_dto_test.dart @@ -11,11 +11,11 @@ import 'package:openapi/api.dart'; import 'package:test/test.dart'; -// tests for SetAlbumPermissionDto +// tests for UpdateAlbumUserDto void main() { - // final instance = SetAlbumPermissionDto(); + // final instance = UpdateAlbumUserDto(); - group('test SetAlbumPermissionDto', () { + group('test UpdateAlbumUserDto', () { // bool readonly test('to test the property `readonly`', () async { // TODO diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 2ef6697baf..38538f7e65 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -591,7 +591,7 @@ }, "/album/{id}/permission/{userId}": { "put": { - "operationId": "setAlbumPermission", + "operationId": "updateAlbumUser", "parameters": [ { "name": "id", @@ -615,7 +615,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SetAlbumPermissionDto" + "$ref": "#/components/schemas/UpdateAlbumUserDto" } } }, @@ -7118,32 +7118,11 @@ ], "type": "object" }, - "AlbumPermissionResponseDto": { - "properties": { - "readonly": { - "type": "boolean" - }, - "user": { - "$ref": "#/components/schemas/UserResponseDto" - } - }, - "required": [ - "readonly", - "user" - ], - "type": "object" - }, "AlbumResponseDto": { "properties": { "albumName": { "type": "string" }, - "albumPermissions": { - "items": { - "$ref": "#/components/schemas/AlbumPermissionResponseDto" - }, - "type": "array" - }, "albumThumbnailAssetId": { "nullable": true, "type": "string" @@ -7195,12 +7174,18 @@ }, "sharedUsers": { "deprecated": true, - "description": "Deprecated in favor of albumPermissions", + "description": "Deprecated in favor of users", "items": { "$ref": "#/components/schemas/UserResponseDto" }, "type": "array" }, + "sharedUsersV2": { + "items": { + "$ref": "#/components/schemas/AlbumUserResponseDto" + }, + "type": "array" + }, "startDate": { "format": "date-time", "type": "string" @@ -7212,7 +7197,6 @@ }, "required": [ "albumName", - "albumPermissions", "albumThumbnailAssetId", "assetCount", "assets", @@ -7225,10 +7209,26 @@ "ownerId", "shared", "sharedUsers", + "sharedUsersV2", "updatedAt" ], "type": "object" }, + "AlbumUserResponseDto": { + "properties": { + "readonly": { + "type": "boolean" + }, + "user": { + "$ref": "#/components/schemas/UserResponseDto" + } + }, + "required": [ + "readonly", + "user" + ], + "type": "object" + }, "AllJobStatusResponseDto": { "properties": { "backgroundTask": { @@ -9967,17 +9967,6 @@ ], "type": "object" }, - "SetAlbumPermissionDto": { - "properties": { - "readonly": { - "type": "boolean" - } - }, - "required": [ - "readonly" - ], - "type": "object" - }, "SharedLinkCreateDto": { "properties": { "albumId": { @@ -10971,6 +10960,17 @@ }, "type": "object" }, + "UpdateAlbumUserDto": { + "properties": { + "readonly": { + "type": "boolean" + } + }, + "required": [ + "readonly" + ], + "type": "object" + }, "UpdateAssetDto": { "properties": { "dateTimeOriginal": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 9e42b67af4..7f828c7766 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -38,28 +38,6 @@ 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 AlbumPermissionResponseDto = { - "readonly": boolean; - user: UserResponseDto; -}; export type ExifResponseDto = { city?: string | null; country?: string | null; @@ -83,6 +61,24 @@ 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; @@ -145,9 +141,12 @@ export type AssetResponseDto = { "type": AssetTypeEnum; updatedAt: string; }; +export type AlbumUserResponseDto = { + "readonly": boolean; + user: UserResponseDto; +}; export type AlbumResponseDto = { albumName: string; - albumPermissions: AlbumPermissionResponseDto[]; albumThumbnailAssetId: string | null; assetCount: number; assets: AssetResponseDto[]; @@ -162,8 +161,9 @@ export type AlbumResponseDto = { owner: UserResponseDto; ownerId: string; shared: boolean; - /** Deprecated in favor of albumPermissions */ + /** Deprecated in favor of users */ sharedUsers: UserResponseDto[]; + sharedUsersV2: AlbumUserResponseDto[]; startDate?: string; updatedAt: string; }; @@ -193,7 +193,7 @@ export type BulkIdResponseDto = { id: string; success: boolean; }; -export type SetAlbumPermissionDto = { +export type UpdateAlbumUserDto = { "readonly": boolean; }; export type AddUsersDto = { @@ -1196,15 +1196,15 @@ export function addAssetsToAlbum({ id, key, bulkIdsDto }: { body: bulkIdsDto }))); } -export function setAlbumPermission({ id, userId, setAlbumPermissionDto }: { +export function updateAlbumUser({ id, userId, updateAlbumUserDto }: { id: string; userId: string; - setAlbumPermissionDto: SetAlbumPermissionDto; + updateAlbumUserDto: UpdateAlbumUserDto; }, opts?: Oazapfts.RequestOpts) { return oazapfts.ok(oazapfts.fetchText(`/album/${encodeURIComponent(id)}/permission/${encodeURIComponent(userId)}`, oazapfts.json({ ...opts, method: "PUT", - body: setAlbumPermissionDto + body: updateAlbumUserDto }))); } export function removeUserFromAlbum({ id, userId }: { diff --git a/server/src/controllers/album.controller.ts b/server/src/controllers/album.controller.ts index 869071f411..7a670d7ed5 100644 --- a/server/src/controllers/album.controller.ts +++ b/server/src/controllers/album.controller.ts @@ -7,8 +7,8 @@ import { AlbumResponseDto, CreateAlbumDto, GetAlbumsDto, - SetAlbumPermissionDto, UpdateAlbumDto, + UpdateAlbumUserDto, } from 'src/dtos/album.dto'; import { BulkIdResponseDto, BulkIdsDto } from 'src/dtos/asset-ids.response.dto'; import { AuthDto } from 'src/dtos/auth.dto'; @@ -99,12 +99,12 @@ export class AlbumController { } @Put(':id/permission/:userId') - setAlbumPermission( + updateAlbumUser( @Auth() auth: AuthDto, @Param() { id }: UUIDParamDto, @Param('userId', new ParseMeUUIDPipe({ version: '4' })) userId: string, - @Body() dto: SetAlbumPermissionDto, + @Body() dto: UpdateAlbumUserDto, ): Promise { - return this.service.setAlbumPermission(auth, id, userId, dto); + return this.service.updateAlbumUser(auth, id, userId, dto); } } diff --git a/server/src/dtos/album.dto.ts b/server/src/dtos/album.dto.ts index ee5d07f667..82db90c9c0 100644 --- a/server/src/dtos/album.dto.ts +++ b/server/src/dtos/album.dto.ts @@ -83,12 +83,12 @@ export class AlbumCountResponseDto { notShared!: number; } -export class SetAlbumPermissionDto { +export class UpdateAlbumUserDto { @ValidateBoolean() readonly!: boolean; } -export class AlbumPermissionResponseDto { +export class AlbumUserResponseDto { user!: UserResponseDto; readonly!: boolean; } @@ -102,9 +102,9 @@ export class AlbumResponseDto { updatedAt!: Date; albumThumbnailAssetId!: string | null; shared!: boolean; - @ApiProperty({ deprecated: true, description: 'Deprecated in favor of albumPermissions' }) + @ApiProperty({ deprecated: true, description: 'Deprecated in favor of users' }) sharedUsers!: UserResponseDto[]; - albumPermissions!: AlbumPermissionResponseDto[]; + sharedUsersV2!: AlbumUserResponseDto[]; hasSharedLink!: boolean; assets!: AssetResponseDto[]; owner!: UserResponseDto; @@ -121,12 +121,12 @@ export class AlbumResponseDto { export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDto): AlbumResponseDto => { const sharedUsers: UserResponseDto[] = []; - const albumPermissions: AlbumPermissionResponseDto[] = []; + const sharedUsersV2: AlbumUserResponseDto[] = []; - if (entity.albumPermissions) { - for (const permission of entity.albumPermissions) { + if (entity.sharedUsers) { + for (const permission of entity.sharedUsers) { sharedUsers.push(mapUser(permission.users)); - albumPermissions.push({ + sharedUsersV2.push({ user: mapUser(permission.users), readonly: permission.readonly, }); @@ -155,7 +155,7 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt ownerId: entity.ownerId, owner: mapUser(entity.owner), sharedUsers, - albumPermissions, + sharedUsersV2, shared: hasSharedUser || hasSharedLink, hasSharedLink, startDate, diff --git a/server/src/entities/album-permission.entity.ts b/server/src/entities/album-user.entity.ts similarity index 95% rename from server/src/entities/album-permission.entity.ts rename to server/src/entities/album-user.entity.ts index 2f1ef8bf77..87cff2e2a5 100644 --- a/server/src/entities/album-permission.entity.ts +++ b/server/src/entities/album-user.entity.ts @@ -6,7 +6,7 @@ import { Column, Entity, Index, ManyToOne, PrimaryColumn } from 'typeorm'; // Indices for JoinTable @Index('IDX_427c350ad49bd3935a50baab73', ['albums']) @Index('IDX_f48513bf9bccefd6ff3ad30bd0', ['users']) -export class AlbumPermissionEntity { +export class AlbumUserEntity { @PrimaryColumn({ type: 'uuid', name: 'albumsId' }) @ManyToOne(() => AlbumEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false }) albums!: AlbumEntity; diff --git a/server/src/entities/album.entity.ts b/server/src/entities/album.entity.ts index 17a89c2a58..ce8492e6b4 100644 --- a/server/src/entities/album.entity.ts +++ b/server/src/entities/album.entity.ts @@ -1,4 +1,4 @@ -import { AlbumPermissionEntity } from 'src/entities/album-permission.entity'; +import { AlbumUserEntity } from 'src/entities/album-user.entity'; import { AssetEntity } from 'src/entities/asset.entity'; import { SharedLinkEntity } from 'src/entities/shared-link.entity'; import { UserEntity } from 'src/entities/user.entity'; @@ -53,8 +53,8 @@ export class AlbumEntity { @Column({ comment: 'Asset ID to be used as thumbnail', nullable: true }) albumThumbnailAssetId!: string | null; - @OneToMany(() => AlbumPermissionEntity, (permission) => permission.albums) - albumPermissions!: AlbumPermissionEntity[]; + @OneToMany(() => AlbumUserEntity, (permission) => permission.albums) + sharedUsers!: AlbumUserEntity[]; @ManyToMany(() => AssetEntity, (asset) => asset.albums) @JoinTable() diff --git a/server/src/entities/index.ts b/server/src/entities/index.ts index f03141f4fe..0a44cc8000 100644 --- a/server/src/entities/index.ts +++ b/server/src/entities/index.ts @@ -1,5 +1,5 @@ import { ActivityEntity } from 'src/entities/activity.entity'; -import { AlbumPermissionEntity } from 'src/entities/album-permission.entity'; +import { AlbumUserEntity } from 'src/entities/album-user.entity'; import { AlbumEntity } from 'src/entities/album.entity'; import { APIKeyEntity } from 'src/entities/api-key.entity'; import { AssetFaceEntity } from 'src/entities/asset-face.entity'; @@ -26,7 +26,7 @@ import { UserEntity } from 'src/entities/user.entity'; export const entities = [ ActivityEntity, AlbumEntity, - AlbumPermissionEntity, + AlbumUserEntity, APIKeyEntity, AssetEntity, AssetStackEntity, diff --git a/server/src/interfaces/album-permission.interface.ts b/server/src/interfaces/album-permission.interface.ts deleted file mode 100644 index 92ed502a82..0000000000 --- a/server/src/interfaces/album-permission.interface.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { AlbumPermissionEntity } from 'src/entities/album-permission.entity'; - -export const IAlbumPermissionRepository = 'IAlbumPermissionRepository'; - -export interface IAlbumPermissionRepository { - create(albumPermission: Partial): Promise; - update( - userId: string, - albumId: string, - albumPermission: Partial, - ): Promise; - delete(userId: string, albumId: string): Promise; -} diff --git a/server/src/interfaces/album-user.interface.ts b/server/src/interfaces/album-user.interface.ts new file mode 100644 index 0000000000..f31cb7f224 --- /dev/null +++ b/server/src/interfaces/album-user.interface.ts @@ -0,0 +1,14 @@ +import { AlbumUserEntity } from 'src/entities/album-user.entity'; + +export const IAlbumUserRepository = 'IAlbumUserRepository'; + +export type AlbumPermissionId = { + albumId: string; + userId: string; +}; + +export interface IAlbumUserRepository { + create(albumPermission: Partial): Promise; + update({ userId, albumId }: AlbumPermissionId, albumPermission: Partial): Promise; + delete({ userId, albumId }: AlbumPermissionId): Promise; +} diff --git a/server/src/queries/access.repository.sql b/server/src/queries/access.repository.sql index 771068f40f..eacdc0d3c8 100644 --- a/server/src/queries/access.repository.sql +++ b/server/src/queries/access.repository.sql @@ -68,22 +68,18 @@ WHERE -- AccessRepository.album.checkSharedAlbumAccess SELECT "AlbumEntity"."id" AS "AlbumEntity_id", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly" + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly" FROM "albums" "AlbumEntity" - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" WHERE ( ( ("AlbumEntity"."id" IN ($1)) AND ( - ( - ( - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" = $2 - ) - ) + (("AlbumEntity__AlbumEntity_users"."usersId" = $2)) ) ) ) diff --git a/server/src/queries/album.repository.sql b/server/src/queries/album.repository.sql index 6bd6cd77e5..f59c8cb6c0 100644 --- a/server/src/queries/album.repository.sql +++ b/server/src/queries/album.repository.sql @@ -32,25 +32,25 @@ FROM "AlbumEntity__AlbumEntity_owner"."memoriesEnabled" AS "AlbumEntity__AlbumEntity_owner_memoriesEnabled", "AlbumEntity__AlbumEntity_owner"."quotaSizeInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaSizeInBytes", "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", - "0cf106548010af7bbb874df2a426f3f6525803ba"."id" AS "0cf106548010af7bbb874df2a426f3f6525803ba_id", - "0cf106548010af7bbb874df2a426f3f6525803ba"."name" AS "0cf106548010af7bbb874df2a426f3f6525803ba_name", - "0cf106548010af7bbb874df2a426f3f6525803ba"."avatarColor" AS "0cf106548010af7bbb874df2a426f3f6525803ba_avatarColor", - "0cf106548010af7bbb874df2a426f3f6525803ba"."isAdmin" AS "0cf106548010af7bbb874df2a426f3f6525803ba_isAdmin", - "0cf106548010af7bbb874df2a426f3f6525803ba"."email" AS "0cf106548010af7bbb874df2a426f3f6525803ba_email", - "0cf106548010af7bbb874df2a426f3f6525803ba"."storageLabel" AS "0cf106548010af7bbb874df2a426f3f6525803ba_storageLabel", - "0cf106548010af7bbb874df2a426f3f6525803ba"."oauthId" AS "0cf106548010af7bbb874df2a426f3f6525803ba_oauthId", - "0cf106548010af7bbb874df2a426f3f6525803ba"."profileImagePath" AS "0cf106548010af7bbb874df2a426f3f6525803ba_profileImagePath", - "0cf106548010af7bbb874df2a426f3f6525803ba"."shouldChangePassword" AS "0cf106548010af7bbb874df2a426f3f6525803ba_shouldChangePassword", - "0cf106548010af7bbb874df2a426f3f6525803ba"."createdAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_createdAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_deletedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."status" AS "0cf106548010af7bbb874df2a426f3f6525803ba_status", - "0cf106548010af7bbb874df2a426f3f6525803ba"."updatedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_updatedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."memoriesEnabled" AS "0cf106548010af7bbb874df2a426f3f6525803ba_memoriesEnabled", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaSizeInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaSizeInBytes", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaUsageInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaUsageInBytes", + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_id", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."name" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_name", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."avatarColor" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_avatarColor", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."isAdmin" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_isAdmin", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."email" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_email", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."storageLabel" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_storageLabel", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."oauthId" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_oauthId", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."profileImagePath" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_profileImagePath", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."shouldChangePassword" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_shouldChangePassword", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."createdAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_createdAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_deletedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."status" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_status", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."updatedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_updatedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."memoriesEnabled" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_memoriesEnabled", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaSizeInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaSizeInBytes", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaUsageInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaUsageInBytes", "AlbumEntity__AlbumEntity_sharedLinks"."id" AS "AlbumEntity__AlbumEntity_sharedLinks_id", "AlbumEntity__AlbumEntity_sharedLinks"."description" AS "AlbumEntity__AlbumEntity_sharedLinks_description", "AlbumEntity__AlbumEntity_sharedLinks"."password" AS "AlbumEntity__AlbumEntity_sharedLinks_password", @@ -69,10 +69,10 @@ FROM AND ( "AlbumEntity__AlbumEntity_owner"."deletedAt" IS NULL ) - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" - LEFT JOIN "users" "0cf106548010af7bbb874df2a426f3f6525803ba" ON "0cf106548010af7bbb874df2a426f3f6525803ba"."id" = "AlbumEntity__AlbumEntity_albumPermissions"."usersId" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "users" "c22bbb73d001d9cda353d6b9ef87490f7558ce0c" ON "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" = "AlbumEntity__AlbumEntity_users"."usersId" AND ( - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" IS NULL + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" IS NULL ) LEFT JOIN "shared_links" "AlbumEntity__AlbumEntity_sharedLinks" ON "AlbumEntity__AlbumEntity_sharedLinks"."albumId" = "AlbumEntity"."id" WHERE @@ -112,35 +112,35 @@ SELECT "AlbumEntity__AlbumEntity_owner"."memoriesEnabled" AS "AlbumEntity__AlbumEntity_owner_memoriesEnabled", "AlbumEntity__AlbumEntity_owner"."quotaSizeInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaSizeInBytes", "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", - "0cf106548010af7bbb874df2a426f3f6525803ba"."id" AS "0cf106548010af7bbb874df2a426f3f6525803ba_id", - "0cf106548010af7bbb874df2a426f3f6525803ba"."name" AS "0cf106548010af7bbb874df2a426f3f6525803ba_name", - "0cf106548010af7bbb874df2a426f3f6525803ba"."avatarColor" AS "0cf106548010af7bbb874df2a426f3f6525803ba_avatarColor", - "0cf106548010af7bbb874df2a426f3f6525803ba"."isAdmin" AS "0cf106548010af7bbb874df2a426f3f6525803ba_isAdmin", - "0cf106548010af7bbb874df2a426f3f6525803ba"."email" AS "0cf106548010af7bbb874df2a426f3f6525803ba_email", - "0cf106548010af7bbb874df2a426f3f6525803ba"."storageLabel" AS "0cf106548010af7bbb874df2a426f3f6525803ba_storageLabel", - "0cf106548010af7bbb874df2a426f3f6525803ba"."oauthId" AS "0cf106548010af7bbb874df2a426f3f6525803ba_oauthId", - "0cf106548010af7bbb874df2a426f3f6525803ba"."profileImagePath" AS "0cf106548010af7bbb874df2a426f3f6525803ba_profileImagePath", - "0cf106548010af7bbb874df2a426f3f6525803ba"."shouldChangePassword" AS "0cf106548010af7bbb874df2a426f3f6525803ba_shouldChangePassword", - "0cf106548010af7bbb874df2a426f3f6525803ba"."createdAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_createdAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_deletedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."status" AS "0cf106548010af7bbb874df2a426f3f6525803ba_status", - "0cf106548010af7bbb874df2a426f3f6525803ba"."updatedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_updatedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."memoriesEnabled" AS "0cf106548010af7bbb874df2a426f3f6525803ba_memoriesEnabled", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaSizeInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaSizeInBytes", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaUsageInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaUsageInBytes" + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_id", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."name" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_name", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."avatarColor" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_avatarColor", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."isAdmin" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_isAdmin", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."email" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_email", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."storageLabel" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_storageLabel", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."oauthId" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_oauthId", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."profileImagePath" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_profileImagePath", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."shouldChangePassword" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_shouldChangePassword", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."createdAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_createdAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_deletedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."status" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_status", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."updatedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_updatedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."memoriesEnabled" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_memoriesEnabled", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaSizeInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaSizeInBytes", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaUsageInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaUsageInBytes" FROM "albums" "AlbumEntity" LEFT JOIN "users" "AlbumEntity__AlbumEntity_owner" ON "AlbumEntity__AlbumEntity_owner"."id" = "AlbumEntity"."ownerId" AND ( "AlbumEntity__AlbumEntity_owner"."deletedAt" IS NULL ) - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" - LEFT JOIN "users" "0cf106548010af7bbb874df2a426f3f6525803ba" ON "0cf106548010af7bbb874df2a426f3f6525803ba"."id" = "AlbumEntity__AlbumEntity_albumPermissions"."usersId" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "users" "c22bbb73d001d9cda353d6b9ef87490f7558ce0c" ON "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" = "AlbumEntity__AlbumEntity_users"."usersId" AND ( - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" IS NULL + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" IS NULL ) WHERE ((("AlbumEntity"."id" IN ($1)))) @@ -174,35 +174,35 @@ SELECT "AlbumEntity__AlbumEntity_owner"."memoriesEnabled" AS "AlbumEntity__AlbumEntity_owner_memoriesEnabled", "AlbumEntity__AlbumEntity_owner"."quotaSizeInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaSizeInBytes", "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", - "0cf106548010af7bbb874df2a426f3f6525803ba"."id" AS "0cf106548010af7bbb874df2a426f3f6525803ba_id", - "0cf106548010af7bbb874df2a426f3f6525803ba"."name" AS "0cf106548010af7bbb874df2a426f3f6525803ba_name", - "0cf106548010af7bbb874df2a426f3f6525803ba"."avatarColor" AS "0cf106548010af7bbb874df2a426f3f6525803ba_avatarColor", - "0cf106548010af7bbb874df2a426f3f6525803ba"."isAdmin" AS "0cf106548010af7bbb874df2a426f3f6525803ba_isAdmin", - "0cf106548010af7bbb874df2a426f3f6525803ba"."email" AS "0cf106548010af7bbb874df2a426f3f6525803ba_email", - "0cf106548010af7bbb874df2a426f3f6525803ba"."storageLabel" AS "0cf106548010af7bbb874df2a426f3f6525803ba_storageLabel", - "0cf106548010af7bbb874df2a426f3f6525803ba"."oauthId" AS "0cf106548010af7bbb874df2a426f3f6525803ba_oauthId", - "0cf106548010af7bbb874df2a426f3f6525803ba"."profileImagePath" AS "0cf106548010af7bbb874df2a426f3f6525803ba_profileImagePath", - "0cf106548010af7bbb874df2a426f3f6525803ba"."shouldChangePassword" AS "0cf106548010af7bbb874df2a426f3f6525803ba_shouldChangePassword", - "0cf106548010af7bbb874df2a426f3f6525803ba"."createdAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_createdAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_deletedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."status" AS "0cf106548010af7bbb874df2a426f3f6525803ba_status", - "0cf106548010af7bbb874df2a426f3f6525803ba"."updatedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_updatedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."memoriesEnabled" AS "0cf106548010af7bbb874df2a426f3f6525803ba_memoriesEnabled", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaSizeInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaSizeInBytes", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaUsageInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaUsageInBytes" + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_id", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."name" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_name", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."avatarColor" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_avatarColor", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."isAdmin" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_isAdmin", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."email" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_email", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."storageLabel" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_storageLabel", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."oauthId" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_oauthId", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."profileImagePath" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_profileImagePath", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."shouldChangePassword" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_shouldChangePassword", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."createdAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_createdAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_deletedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."status" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_status", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."updatedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_updatedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."memoriesEnabled" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_memoriesEnabled", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaSizeInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaSizeInBytes", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaUsageInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaUsageInBytes" FROM "albums" "AlbumEntity" LEFT JOIN "users" "AlbumEntity__AlbumEntity_owner" ON "AlbumEntity__AlbumEntity_owner"."id" = "AlbumEntity"."ownerId" AND ( "AlbumEntity__AlbumEntity_owner"."deletedAt" IS NULL ) - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" - LEFT JOIN "users" "0cf106548010af7bbb874df2a426f3f6525803ba" ON "0cf106548010af7bbb874df2a426f3f6525803ba"."id" = "AlbumEntity__AlbumEntity_albumPermissions"."usersId" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "users" "c22bbb73d001d9cda353d6b9ef87490f7558ce0c" ON "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" = "AlbumEntity__AlbumEntity_users"."usersId" AND ( - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" IS NULL + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" IS NULL ) LEFT JOIN "albums_assets_assets" "AlbumEntity_AlbumEntity__AlbumEntity_assets" ON "AlbumEntity_AlbumEntity__AlbumEntity_assets"."albumsId" = "AlbumEntity"."id" LEFT JOIN "assets" "AlbumEntity__AlbumEntity_assets" ON "AlbumEntity__AlbumEntity_assets"."id" = "AlbumEntity_AlbumEntity__AlbumEntity_assets"."assetsId" @@ -221,11 +221,7 @@ WHERE OR ( ( ( - ( - ( - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" = $3 - ) - ) + (("AlbumEntity__AlbumEntity_users"."usersId" = $3)) ) AND ((("AlbumEntity__AlbumEntity_assets"."id" = $4))) ) @@ -294,25 +290,25 @@ SELECT "AlbumEntity"."albumThumbnailAssetId" AS "AlbumEntity_albumThumbnailAssetId", "AlbumEntity"."isActivityEnabled" AS "AlbumEntity_isActivityEnabled", "AlbumEntity"."order" AS "AlbumEntity_order", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", - "0cf106548010af7bbb874df2a426f3f6525803ba"."id" AS "0cf106548010af7bbb874df2a426f3f6525803ba_id", - "0cf106548010af7bbb874df2a426f3f6525803ba"."name" AS "0cf106548010af7bbb874df2a426f3f6525803ba_name", - "0cf106548010af7bbb874df2a426f3f6525803ba"."avatarColor" AS "0cf106548010af7bbb874df2a426f3f6525803ba_avatarColor", - "0cf106548010af7bbb874df2a426f3f6525803ba"."isAdmin" AS "0cf106548010af7bbb874df2a426f3f6525803ba_isAdmin", - "0cf106548010af7bbb874df2a426f3f6525803ba"."email" AS "0cf106548010af7bbb874df2a426f3f6525803ba_email", - "0cf106548010af7bbb874df2a426f3f6525803ba"."storageLabel" AS "0cf106548010af7bbb874df2a426f3f6525803ba_storageLabel", - "0cf106548010af7bbb874df2a426f3f6525803ba"."oauthId" AS "0cf106548010af7bbb874df2a426f3f6525803ba_oauthId", - "0cf106548010af7bbb874df2a426f3f6525803ba"."profileImagePath" AS "0cf106548010af7bbb874df2a426f3f6525803ba_profileImagePath", - "0cf106548010af7bbb874df2a426f3f6525803ba"."shouldChangePassword" AS "0cf106548010af7bbb874df2a426f3f6525803ba_shouldChangePassword", - "0cf106548010af7bbb874df2a426f3f6525803ba"."createdAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_createdAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_deletedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."status" AS "0cf106548010af7bbb874df2a426f3f6525803ba_status", - "0cf106548010af7bbb874df2a426f3f6525803ba"."updatedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_updatedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."memoriesEnabled" AS "0cf106548010af7bbb874df2a426f3f6525803ba_memoriesEnabled", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaSizeInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaSizeInBytes", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaUsageInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaUsageInBytes", + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_id", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."name" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_name", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."avatarColor" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_avatarColor", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."isAdmin" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_isAdmin", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."email" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_email", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."storageLabel" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_storageLabel", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."oauthId" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_oauthId", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."profileImagePath" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_profileImagePath", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."shouldChangePassword" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_shouldChangePassword", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."createdAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_createdAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_deletedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."status" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_status", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."updatedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_updatedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."memoriesEnabled" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_memoriesEnabled", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaSizeInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaSizeInBytes", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaUsageInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaUsageInBytes", "AlbumEntity__AlbumEntity_sharedLinks"."id" AS "AlbumEntity__AlbumEntity_sharedLinks_id", "AlbumEntity__AlbumEntity_sharedLinks"."description" AS "AlbumEntity__AlbumEntity_sharedLinks_description", "AlbumEntity__AlbumEntity_sharedLinks"."password" AS "AlbumEntity__AlbumEntity_sharedLinks_password", @@ -343,10 +339,10 @@ SELECT "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes" FROM "albums" "AlbumEntity" - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" - LEFT JOIN "users" "0cf106548010af7bbb874df2a426f3f6525803ba" ON "0cf106548010af7bbb874df2a426f3f6525803ba"."id" = "AlbumEntity__AlbumEntity_albumPermissions"."usersId" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "users" "c22bbb73d001d9cda353d6b9ef87490f7558ce0c" ON "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" = "AlbumEntity__AlbumEntity_users"."usersId" AND ( - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" IS NULL + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" IS NULL ) LEFT JOIN "shared_links" "AlbumEntity__AlbumEntity_sharedLinks" ON "AlbumEntity__AlbumEntity_sharedLinks"."albumId" = "AlbumEntity"."id" LEFT JOIN "users" "AlbumEntity__AlbumEntity_owner" ON "AlbumEntity__AlbumEntity_owner"."id" = "AlbumEntity"."ownerId" @@ -371,25 +367,25 @@ SELECT "AlbumEntity"."albumThumbnailAssetId" AS "AlbumEntity_albumThumbnailAssetId", "AlbumEntity"."isActivityEnabled" AS "AlbumEntity_isActivityEnabled", "AlbumEntity"."order" AS "AlbumEntity_order", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", - "0cf106548010af7bbb874df2a426f3f6525803ba"."id" AS "0cf106548010af7bbb874df2a426f3f6525803ba_id", - "0cf106548010af7bbb874df2a426f3f6525803ba"."name" AS "0cf106548010af7bbb874df2a426f3f6525803ba_name", - "0cf106548010af7bbb874df2a426f3f6525803ba"."avatarColor" AS "0cf106548010af7bbb874df2a426f3f6525803ba_avatarColor", - "0cf106548010af7bbb874df2a426f3f6525803ba"."isAdmin" AS "0cf106548010af7bbb874df2a426f3f6525803ba_isAdmin", - "0cf106548010af7bbb874df2a426f3f6525803ba"."email" AS "0cf106548010af7bbb874df2a426f3f6525803ba_email", - "0cf106548010af7bbb874df2a426f3f6525803ba"."storageLabel" AS "0cf106548010af7bbb874df2a426f3f6525803ba_storageLabel", - "0cf106548010af7bbb874df2a426f3f6525803ba"."oauthId" AS "0cf106548010af7bbb874df2a426f3f6525803ba_oauthId", - "0cf106548010af7bbb874df2a426f3f6525803ba"."profileImagePath" AS "0cf106548010af7bbb874df2a426f3f6525803ba_profileImagePath", - "0cf106548010af7bbb874df2a426f3f6525803ba"."shouldChangePassword" AS "0cf106548010af7bbb874df2a426f3f6525803ba_shouldChangePassword", - "0cf106548010af7bbb874df2a426f3f6525803ba"."createdAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_createdAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_deletedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."status" AS "0cf106548010af7bbb874df2a426f3f6525803ba_status", - "0cf106548010af7bbb874df2a426f3f6525803ba"."updatedAt" AS "0cf106548010af7bbb874df2a426f3f6525803ba_updatedAt", - "0cf106548010af7bbb874df2a426f3f6525803ba"."memoriesEnabled" AS "0cf106548010af7bbb874df2a426f3f6525803ba_memoriesEnabled", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaSizeInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaSizeInBytes", - "0cf106548010af7bbb874df2a426f3f6525803ba"."quotaUsageInBytes" AS "0cf106548010af7bbb874df2a426f3f6525803ba_quotaUsageInBytes", + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_id", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."name" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_name", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."avatarColor" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_avatarColor", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."isAdmin" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_isAdmin", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."email" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_email", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."storageLabel" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_storageLabel", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."oauthId" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_oauthId", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."profileImagePath" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_profileImagePath", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."shouldChangePassword" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_shouldChangePassword", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."createdAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_createdAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_deletedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."status" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_status", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."updatedAt" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_updatedAt", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."memoriesEnabled" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_memoriesEnabled", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaSizeInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaSizeInBytes", + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."quotaUsageInBytes" AS "c22bbb73d001d9cda353d6b9ef87490f7558ce0c_quotaUsageInBytes", "AlbumEntity__AlbumEntity_sharedLinks"."id" AS "AlbumEntity__AlbumEntity_sharedLinks_id", "AlbumEntity__AlbumEntity_sharedLinks"."description" AS "AlbumEntity__AlbumEntity_sharedLinks_description", "AlbumEntity__AlbumEntity_sharedLinks"."password" AS "AlbumEntity__AlbumEntity_sharedLinks_password", @@ -420,10 +416,10 @@ SELECT "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes" FROM "albums" "AlbumEntity" - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" - LEFT JOIN "users" "0cf106548010af7bbb874df2a426f3f6525803ba" ON "0cf106548010af7bbb874df2a426f3f6525803ba"."id" = "AlbumEntity__AlbumEntity_albumPermissions"."usersId" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "users" "c22bbb73d001d9cda353d6b9ef87490f7558ce0c" ON "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."id" = "AlbumEntity__AlbumEntity_users"."usersId" AND ( - "0cf106548010af7bbb874df2a426f3f6525803ba"."deletedAt" IS NULL + "c22bbb73d001d9cda353d6b9ef87490f7558ce0c"."deletedAt" IS NULL ) LEFT JOIN "shared_links" "AlbumEntity__AlbumEntity_sharedLinks" ON "AlbumEntity__AlbumEntity_sharedLinks"."albumId" = "AlbumEntity"."id" LEFT JOIN "users" "AlbumEntity__AlbumEntity_owner" ON "AlbumEntity__AlbumEntity_owner"."id" = "AlbumEntity"."ownerId" @@ -436,11 +432,7 @@ WHERE ( ( ( - ( - ( - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" = $1 - ) - ) + (("AlbumEntity__AlbumEntity_users"."usersId" = $1)) ) ) ) @@ -462,7 +454,7 @@ WHERE ( ( NOT ( - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" IS NULL + "AlbumEntity__AlbumEntity_users"."usersId" IS NULL ) ) ) @@ -487,9 +479,9 @@ SELECT "AlbumEntity"."albumThumbnailAssetId" AS "AlbumEntity_albumThumbnailAssetId", "AlbumEntity"."isActivityEnabled" AS "AlbumEntity_isActivityEnabled", "AlbumEntity"."order" AS "AlbumEntity_order", - "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" AS "AlbumEntity__AlbumEntity_albumPermissions_albumsId", - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" AS "AlbumEntity__AlbumEntity_albumPermissions_usersId", - "AlbumEntity__AlbumEntity_albumPermissions"."readonly" AS "AlbumEntity__AlbumEntity_albumPermissions_readonly", + "AlbumEntity__AlbumEntity_users"."albumsId" AS "AlbumEntity__AlbumEntity_users_albumsId", + "AlbumEntity__AlbumEntity_users"."usersId" AS "AlbumEntity__AlbumEntity_users_usersId", + "AlbumEntity__AlbumEntity_users"."readonly" AS "AlbumEntity__AlbumEntity_users_readonly", "AlbumEntity__AlbumEntity_sharedLinks"."id" AS "AlbumEntity__AlbumEntity_sharedLinks_id", "AlbumEntity__AlbumEntity_sharedLinks"."description" AS "AlbumEntity__AlbumEntity_sharedLinks_description", "AlbumEntity__AlbumEntity_sharedLinks"."password" AS "AlbumEntity__AlbumEntity_sharedLinks_password", @@ -520,7 +512,7 @@ SELECT "AlbumEntity__AlbumEntity_owner"."quotaUsageInBytes" AS "AlbumEntity__AlbumEntity_owner_quotaUsageInBytes" FROM "albums" "AlbumEntity" - LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_albumPermissions" ON "AlbumEntity__AlbumEntity_albumPermissions"."albumsId" = "AlbumEntity"."id" + LEFT JOIN "albums_shared_users_users" "AlbumEntity__AlbumEntity_users" ON "AlbumEntity__AlbumEntity_users"."albumsId" = "AlbumEntity"."id" LEFT JOIN "shared_links" "AlbumEntity__AlbumEntity_sharedLinks" ON "AlbumEntity__AlbumEntity_sharedLinks"."albumId" = "AlbumEntity"."id" LEFT JOIN "users" "AlbumEntity__AlbumEntity_owner" ON "AlbumEntity__AlbumEntity_owner"."id" = "AlbumEntity"."ownerId" AND ( @@ -533,7 +525,7 @@ WHERE AND ( ( ( - "AlbumEntity__AlbumEntity_albumPermissions"."usersId" IS NULL + "AlbumEntity__AlbumEntity_users"."usersId" IS NULL ) ) ) diff --git a/server/src/repositories/access.repository.ts b/server/src/repositories/access.repository.ts index 62c6c92d8d..84cf7083c3 100644 --- a/server/src/repositories/access.repository.ts +++ b/server/src/repositories/access.repository.ts @@ -79,8 +79,8 @@ class ActivityAccess implements IActivityAccess { return this.albumRepository .createQueryBuilder('album') .select('album.id') - .leftJoin('album.albumPermissions', 'albumPermissions') - .leftJoin('albumPermissions.users', 'sharedUsers') + .leftJoin('album.sharedUsers', 'albumSharedUsers') + .leftJoin('albumSharedUsers.users', 'sharedUsers') .where('album.id IN (:...albumIds)', { albumIds: [...albumIds] }) .andWhere('album.isActivityEnabled = true') .andWhere( @@ -127,11 +127,11 @@ class AlbumAccess implements IAlbumAccess { return this.albumRepository .find({ select: { id: true }, - relations: { albumPermissions: true }, + relations: { sharedUsers: true }, // -@ts-expect-error asd where: { id: In([...albumIds]), - albumPermissions: { + sharedUsers: { users: Equal(userId), // If write is needed we check for it, otherwise both are accepted readonly: readWrite === 'write' ? false : undefined, @@ -180,7 +180,7 @@ class AssetAccess implements IAssetAccess { return this.albumRepository .createQueryBuilder('album') .innerJoin('album.assets', 'asset') - .leftJoin('album.albumPermissions', 'albumPermissions') + .leftJoin('album.users', 'albumPermissions') .leftJoin('albumPermissions.users', 'sharedUsers') .select('asset.id', 'assetId') .addSelect('asset.livePhotoVideoId', 'livePhotoVideoId') diff --git a/server/src/repositories/album-permission.repository.ts b/server/src/repositories/album-user.repository.ts similarity index 56% rename from server/src/repositories/album-permission.repository.ts rename to server/src/repositories/album-user.repository.ts index a569e324d3..054f95cf46 100644 --- a/server/src/repositories/album-permission.repository.ts +++ b/server/src/repositories/album-user.repository.ts @@ -1,22 +1,21 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Equals } from 'class-validator'; -import { AlbumPermissionEntity } from 'src/entities/album-permission.entity'; -import { IAlbumPermissionRepository } from 'src/interfaces/album-permission.interface'; +import { AlbumUserEntity } from 'src/entities/album-user.entity'; +import { AlbumPermissionId, IAlbumUserRepository } from 'src/interfaces/album-user.interface'; import { Instrumentation } from 'src/utils/instrumentation'; import { Equal, Repository } from 'typeorm'; @Instrumentation() @Injectable() -export class AlbumPermissionRepository implements IAlbumPermissionRepository { - constructor(@InjectRepository(AlbumPermissionEntity) private repository: Repository) {} +export class AlbumUserRepository implements IAlbumUserRepository { + constructor(@InjectRepository(AlbumUserEntity) private repository: Repository) {} - async create(dto: Partial): Promise { + async create(dto: Partial): Promise { const { users, albums } = await this.repository.save(dto); return this.repository.findOneOrFail({ where: { users, albums }, relations: { users: true } }); } - async update(userId: string, albumId: string, dto: Partial): Promise { + async update({ userId, albumId }: AlbumPermissionId, dto: Partial): Promise { // @ts-expect-error I'm pretty sure I messed something up with the entity because // if I follow what typescript says I get postgres errors await this.repository.update({ users: userId, albums: albumId }, dto); @@ -26,7 +25,7 @@ export class AlbumPermissionRepository implements IAlbumPermissionRepository { }); } - async delete(userId: string, albumId: string): Promise { + async delete({ userId, albumId }: AlbumPermissionId): Promise { await this.repository.delete({ users: { id: userId }, albums: { id: albumId } }); } } diff --git a/server/src/repositories/album.repository.ts b/server/src/repositories/album.repository.ts index d7335c548e..eebe4ea65d 100644 --- a/server/src/repositories/album.repository.ts +++ b/server/src/repositories/album.repository.ts @@ -23,7 +23,7 @@ export class AlbumRepository implements IAlbumRepository { getById(id: string, options: AlbumInfoOptions): Promise { const relations: FindOptionsRelations = { owner: true, - albumPermissions: { users: true }, + sharedUsers: { users: true }, assets: false, sharedLinks: true, }; @@ -52,7 +52,7 @@ export class AlbumRepository implements IAlbumRepository { }, relations: { owner: true, - albumPermissions: { users: true }, + sharedUsers: { users: true }, }, }); } @@ -62,9 +62,9 @@ export class AlbumRepository implements IAlbumRepository { return this.repository.find({ where: [ { ownerId, assets: { id: assetId } }, - { albumPermissions: { users: Equal(ownerId) }, assets: { id: assetId } }, + { sharedUsers: { users: Equal(ownerId) }, assets: { id: assetId } }, ], - relations: { owner: true, albumPermissions: { users: true } }, + relations: { owner: true, sharedUsers: { users: true } }, order: { createdAt: 'DESC' }, }); } @@ -129,7 +129,7 @@ export class AlbumRepository implements IAlbumRepository { @GenerateSql({ params: [DummyValue.UUID] }) getOwned(ownerId: string): Promise { return this.repository.find({ - relations: { albumPermissions: { users: true }, sharedLinks: true, owner: true }, + relations: { sharedUsers: { users: true }, sharedLinks: true, owner: true }, where: { ownerId }, order: { createdAt: 'DESC' }, }); @@ -141,11 +141,11 @@ export class AlbumRepository implements IAlbumRepository { @GenerateSql({ params: [DummyValue.UUID] }) getShared(ownerId: string): Promise { return this.repository.find({ - relations: { albumPermissions: { users: true }, sharedLinks: true, owner: true }, + relations: { sharedUsers: { users: true }, sharedLinks: true, owner: true }, where: [ - { albumPermissions: { users: Equal(ownerId) } }, + { sharedUsers: { users: Equal(ownerId) } }, { sharedLinks: { userId: ownerId } }, - { ownerId, albumPermissions: { users: Not(IsNull()) } }, + { ownerId, sharedUsers: { users: Not(IsNull()) } }, ], order: { createdAt: 'DESC' }, }); @@ -157,8 +157,8 @@ export class AlbumRepository implements IAlbumRepository { @GenerateSql({ params: [DummyValue.UUID] }) getNotShared(ownerId: string): Promise { return this.repository.find({ - relations: { albumPermissions: true, sharedLinks: true, owner: true }, - where: { ownerId, albumPermissions: { users: IsNull() }, sharedLinks: { id: IsNull() } }, + relations: { sharedUsers: true, sharedLinks: true, owner: true }, + where: { ownerId, sharedUsers: { users: IsNull() }, sharedLinks: { id: IsNull() } }, order: { createdAt: 'DESC' }, }); } @@ -282,7 +282,7 @@ export class AlbumRepository implements IAlbumRepository { where: { id }, relations: { owner: true, - albumPermissions: { users: true }, + sharedUsers: { users: true }, sharedLinks: true, assets: true, }, diff --git a/server/src/repositories/index.ts b/server/src/repositories/index.ts index bd5bd13b4e..a7cf67de96 100644 --- a/server/src/repositories/index.ts +++ b/server/src/repositories/index.ts @@ -1,6 +1,6 @@ import { IAccessRepository } from 'src/interfaces/access.interface'; import { IActivityRepository } from 'src/interfaces/activity.interface'; -import { IAlbumPermissionRepository } from 'src/interfaces/album-permission.interface'; +import { IAlbumUserRepository } from 'src/interfaces/album-user.interface'; import { IAlbumRepository } from 'src/interfaces/album.interface'; import { IKeyRepository } from 'src/interfaces/api-key.interface'; import { IAssetStackRepository } from 'src/interfaces/asset-stack.interface'; @@ -31,7 +31,7 @@ import { IUserTokenRepository } from 'src/interfaces/user-token.interface'; import { IUserRepository } from 'src/interfaces/user.interface'; import { AccessRepository } from 'src/repositories/access.repository'; import { ActivityRepository } from 'src/repositories/activity.repository'; -import { AlbumPermissionRepository } from 'src/repositories/album-permission.repository'; +import { AlbumUserRepository } from 'src/repositories/album-user.repository'; import { AlbumRepository } from 'src/repositories/album.repository'; import { ApiKeyRepository } from 'src/repositories/api-key.repository'; import { AssetStackRepository } from 'src/repositories/asset-stack.repository'; @@ -65,7 +65,7 @@ export const repositories = [ { provide: IActivityRepository, useClass: ActivityRepository }, { provide: IAccessRepository, useClass: AccessRepository }, { provide: IAlbumRepository, useClass: AlbumRepository }, - { provide: IAlbumPermissionRepository, useClass: AlbumPermissionRepository }, + { provide: IAlbumUserRepository, useClass: AlbumUserRepository }, { provide: IAssetRepository, useClass: AssetRepository }, { provide: IAssetRepositoryV1, useClass: AssetRepositoryV1 }, { provide: IAssetStackRepository, useClass: AssetStackRepository }, diff --git a/server/src/services/album.service.ts b/server/src/services/album.service.ts index f3e6748d57..c45abd8dc5 100644 --- a/server/src/services/album.service.ts +++ b/server/src/services/album.service.ts @@ -14,11 +14,11 @@ import { } from 'src/dtos/album.dto'; import { BulkIdResponseDto, BulkIdsDto } from 'src/dtos/asset-ids.response.dto'; import { AuthDto } from 'src/dtos/auth.dto'; -import { AlbumPermissionEntity } from 'src/entities/album-permission.entity'; +import { AlbumUserEntity } from 'src/entities/album-user.entity'; import { AlbumEntity } from 'src/entities/album.entity'; import { AssetEntity } from 'src/entities/asset.entity'; import { IAccessRepository } from 'src/interfaces/access.interface'; -import { IAlbumPermissionRepository } from 'src/interfaces/album-permission.interface'; +import { IAlbumUserRepository } from 'src/interfaces/album-user.interface'; import { AlbumAssetCount, AlbumInfoOptions, IAlbumRepository } from 'src/interfaces/album.interface'; import { IAssetRepository } from 'src/interfaces/asset.interface'; import { IUserRepository } from 'src/interfaces/user.interface'; @@ -32,7 +32,7 @@ export class AlbumService { @Inject(IAlbumRepository) private albumRepository: IAlbumRepository, @Inject(IAssetRepository) private assetRepository: IAssetRepository, @Inject(IUserRepository) private userRepository: IUserRepository, - @Inject(IAlbumPermissionRepository) private albumPermissionRepository: IAlbumPermissionRepository, + @Inject(IAlbumUserRepository) private albumPermissionRepository: IAlbumUserRepository, ) { this.access = AccessCore.create(accessRepository); } @@ -128,8 +128,7 @@ export class AlbumService { ownerId: auth.user.id, albumName: dto.albumName, description: dto.description, - albumPermissions: - dto.sharedWithUserIds?.map((userId) => ({ users: { id: userId } }) as AlbumPermissionEntity) ?? [], + sharedUsers: dto.sharedWithUserIds?.map((userId) => ({ users: { id: userId } }) as AlbumUserEntity) ?? [], assets, albumThumbnailAssetId: assets[0]?.id || null, }); @@ -222,7 +221,7 @@ export class AlbumService { throw new BadRequestException('Cannot be shared with owner'); } - const exists = album.albumPermissions.find(({ users: { id } }) => id === userId); + const exists = album.sharedUsers.find(({ users: { id } }) => id === userId); if (exists) { throw new BadRequestException('User already added'); } @@ -232,8 +231,8 @@ export class AlbumService { throw new BadRequestException('User not found'); } - album.albumPermissions.push( - await this.albumPermissionRepository.create({ users: { id: userId }, albums: { id } } as AlbumPermissionEntity), + album.sharedUsers.push( + await this.albumPermissionRepository.create({ users: { id: userId }, albums: { id } } as AlbumUserEntity), ); } @@ -251,7 +250,7 @@ export class AlbumService { throw new BadRequestException('Cannot remove album owner'); } - const exists = album.albumPermissions.find(({ users: { id } }) => id === userId); + const exists = album.sharedUsers.find(({ users: { id } }) => id === userId); if (!exists) { throw new BadRequestException('Album not shared with user'); } @@ -261,25 +260,20 @@ export class AlbumService { await this.access.requirePermission(auth, Permission.ALBUM_SHARE, id); } - await this.albumPermissionRepository.delete(userId, id); + await this.albumPermissionRepository.delete({ albumId: id, userId }); } - async setAlbumPermission( - auth: AuthDto, - id: string, - userId: string, - dto: Partial, - ): Promise { + async updateAlbumUser(auth: AuthDto, id: string, userId: string, dto: Partial): Promise { await this.access.requirePermission(auth, Permission.ALBUM_SHARE, id); const album = await this.findOrFail(id, { withAssets: false }); - const permission = album.albumPermissions.find(({ users: { id } }) => id === userId); + const permission = album.sharedUsers.find(({ users: { id } }) => id === userId); if (!permission) { throw new BadRequestException('Album not shared with user'); } - await this.albumPermissionRepository.update(userId, id, { readonly: dto.readonly }); + await this.albumPermissionRepository.update({ albumId: id, userId }, { readonly: dto.readonly }); } private async findOrFail(id: string, options: AlbumInfoOptions) { diff --git a/web/src/lib/components/album-page/share-info-modal.svelte b/web/src/lib/components/album-page/share-info-modal.svelte index 8ec942b425..79d10c5294 100644 --- a/web/src/lib/components/album-page/share-info-modal.svelte +++ b/web/src/lib/components/album-page/share-info-modal.svelte @@ -1,5 +1,11 @@ {#if !selectedRemoveUser} @@ -92,11 +98,15 @@

Owner

- {#each album.albumPermissions.toSorted((a, b) => { - if (a.readonly && !b.readonly) return 1; - if (!a.readonly && b.readonly) return -1; + {#each album.sharedUsersV2.toSorted((a, b) => { + if (a.readonly && !b.readonly) { + return 1; + } + if (!a.readonly && b.readonly) { + return -1; + } return a.user.name.localeCompare(b.user.name); - }) as {user, readonly}} + }) as { user, readonly }}
diff --git a/web/src/routes/(user)/albums/[albumId]/+page.svelte b/web/src/routes/(user)/albums/[albumId]/+page.svelte index 0411d98090..0bc9da6e8b 100644 --- a/web/src/routes/(user)/albums/[albumId]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId]/+page.svelte @@ -136,8 +136,8 @@ $: showActivityStatus = album.sharedUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0); - $: userHasWriteAccess = !album.albumPermissions.find(({ user: {id } }) => id === $user.id)?.readonly; - $: albumHasReadonlyUsers = album.albumPermissions.some(({ readonly }) => readonly); + $: userHasWriteAccess = !album.sharedUsersV2.find(({ user: { id } }) => id === $user.id)?.readonly; + $: albumHasReadonlyUsers = album.sharedUsersV2.some(({ readonly }) => readonly); afterNavigate(({ from }) => { assetViewingStore.showAssetViewer(false); @@ -344,14 +344,6 @@ } }; - const handleUpdatePermissions = async () => { - try { - await refreshAlbum(); - } catch (error) { - handleError(error, 'Error updating permissions'); - } - }; - const handleDownloadAlbum = async () => { await downloadAlbum(album); }; @@ -592,7 +584,7 @@ - {#each album.albumPermissions.filter(({readonly}) => !readonly) as {user} (user.id)} + {#each album.sharedUsersV2.filter(({ readonly }) => !readonly) as { user } (user.id)} @@ -703,7 +695,7 @@ onClose={() => (viewMode = ViewMode.VIEW)} {album} on:remove={({ detail: userId }) => handleRemoveUser(userId)} - on:updatePermissions={handleUpdatePermissions} + on:refreshAlbum={refreshAlbum} /> {/if}