Skip to content

Commit

Permalink
edit esekShare in albumedit
Browse files Browse the repository at this point in the history
  • Loading branch information
pontussjostedt committed Oct 17, 2024
1 parent 8391bd7 commit e5e5a89
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 8 deletions.
10 changes: 9 additions & 1 deletion mobile/openapi/lib/model/album_response_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion mobile/openapi/lib/model/update_album_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7624,6 +7624,9 @@
"format": "date-time",
"type": "string"
},
"esekShared": {
"type": "boolean"
},
"hasSharedLink": {
"type": "boolean"
},
Expand Down Expand Up @@ -7666,6 +7669,7 @@
"assets",
"createdAt",
"description",
"esekShared",
"hasSharedLink",
"id",
"isActivityEnabled",
Expand Down Expand Up @@ -12399,6 +12403,9 @@
"description": {
"type": "string"
},
"esekShared": {
"type": "boolean"
},
"isActivityEnabled": {
"type": "boolean"
},
Expand Down
2 changes: 2 additions & 0 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export type AlbumResponseDto = {
createdAt: string;
description: string;
endDate?: string;
esekShared: boolean;
hasSharedLink: boolean;
id: string;
isActivityEnabled: boolean;
Expand Down Expand Up @@ -314,6 +315,7 @@ export type UpdateAlbumDto = {
albumName?: string;
albumThumbnailAssetId?: string;
description?: string;
esekShared?: boolean;
isActivityEnabled?: boolean;
order?: AssetOrder;
};
Expand Down
5 changes: 5 additions & 0 deletions server/src/dtos/album.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export class UpdateAlbumDto {
@ValidateBoolean({ optional: true })
isActivityEnabled?: boolean;

@ValidateBoolean({optional: false})
esekShared?: boolean;

@IsEnum(AssetOrder)
@Optional()
@ApiProperty({ enum: AssetOrder, enumName: 'AssetOrder' })
Expand Down Expand Up @@ -130,6 +133,7 @@ export class AlbumResponseDto {
updatedAt!: Date;
albumThumbnailAssetId!: string | null;
shared!: boolean;
esekShared!: boolean;
albumUsers!: AlbumUserResponseDto[];
hasSharedLink!: boolean;
assets!: AssetResponseDto[];
Expand Down Expand Up @@ -185,6 +189,7 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
owner: mapUser(entity.owner),
albumUsers: albumUsersSorted,
shared: hasSharedUser || hasSharedLink,
esekShared: entity.esekShared,
hasSharedLink,
startDate,
endDate,
Expand Down
6 changes: 3 additions & 3 deletions server/src/middleware/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ export class AuthGuard implements CanActivate {
const {
admin: adminRoute,
sharedLink: sharedLinkRoute,
esekShare: esekShareRoute,
esekShared: esekSharedRoute,
permission,
} = { sharedLink: false, esekShare: false, admin: false, ...options };
} = { sharedLink: false, esekShared: false, admin: false, ...options };
const request = context.switchToHttp().getRequest<AuthRequest>();

request.user = await this.authService.authenticate({
headers: request.headers,
queryParams: request.query as Record<string, string>,
metadata: { adminRoute, esekShareRoute, sharedLinkRoute, permission, uri: request.path },
metadata: { adminRoute, esekSharedRoute, sharedLinkRoute, permission, uri: request.path },
});

return true;
Expand Down
2 changes: 1 addition & 1 deletion server/src/repositories/event.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class EventRepository implements OnGatewayConnection, OnGatewayDisconnect
const auth = await this.moduleRef.get(AuthService).authenticate({
headers: client.request.headers,
queryParams: {},
metadata: { adminRoute: false, sharedLinkRoute: false, esekShareRoute: true, uri: '/api/socket.io' },
metadata: { adminRoute: false, sharedLinkRoute: false, esekSharedRoute: true, uri: '/api/socket.io' },
});
await client.join(auth.user.id);
if (auth.session) {
Expand Down
1 change: 1 addition & 0 deletions server/src/services/album.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export class AlbumService extends BaseService {
albumThumbnailAssetId: dto.albumThumbnailAssetId,
isActivityEnabled: dto.isActivityEnabled,
order: dto.order,
esekShared: dto.esekShared,
});

return mapAlbumWithoutAssets(updatedAlbum);
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type ValidateRequest = {
headers: IncomingHttpHeaders;
queryParams: Record<string, string>;
metadata: {
esekShareRoute: boolean;
esekSharedRoute: boolean;
sharedLinkRoute: boolean;
adminRoute: boolean;
permission?: Permission;
Expand Down
1 change: 0 additions & 1 deletion web/src/lib/components/album-page/albums-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@
<MenuOption icon={mdiDeleteOutline} text={$t('delete')} onClick={() => setAlbumToDelete()} />
{/if}
</RightClickContextMenu>

{#if allowEdit}
<!-- Edit Modal -->
{#if albumToEdit}
Expand Down
6 changes: 6 additions & 0 deletions web/src/lib/components/forms/edit-album-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import AlbumCover from '$lib/components/album-page/album-cover.svelte';
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
import { t } from 'svelte-i18n';
import Checkbox from '$lib/components/elements/checkbox.svelte';
export let album: AlbumResponseDto;
export let onEditSuccess: ((album: AlbumResponseDto) => unknown) | undefined = undefined;
Expand All @@ -13,6 +14,7 @@
let albumName = album.albumName;
let description = album.description;
let esekShared = album.esekShared;
let isSubmitting = false;
Expand All @@ -24,6 +26,7 @@
updateAlbumDto: {
albumName,
description,
esekShared,
},
});
album.albumName = albumName;
Expand Down Expand Up @@ -54,6 +57,9 @@
<label class="immich-form-label" for="description">{$t('description')}</label>
<textarea class="immich-form-input" id="description" bind:value={description} />
</div>
<div class="m-4">
<Checkbox bind:checked={esekShared} label="esekShared" id="esekShared-input"></Checkbox>
</div>
</div>
</div>
</form>
Expand Down

0 comments on commit e5e5a89

Please sign in to comment.