Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): deduplication UI #9540

Merged
merged 45 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2649e48
feat(web): deduplication UI
alextran1502 May 16, 2024
a36e7fb
fix: missing authenticated decorator
alextran1502 May 16, 2024
9645b52
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 17, 2024
3647ebb
merge main
alextran1502 May 17, 2024
6713115
utilities menu
alextran1502 May 17, 2024
ecc3469
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 17, 2024
aa92329
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 17, 2024
2bd8c94
router
alextran1502 May 17, 2024
e330b7f
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 17, 2024
aa62282
naming convention
alextran1502 May 17, 2024
5341422
get assets
alextran1502 May 17, 2024
02b6275
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 18, 2024
74c4987
openapi
alextran1502 May 18, 2024
d683b63
Merge branch 'main' of github.com:immich-app/immich into feat/web-dup…
alextran1502 May 18, 2024
20f8c66
update
alextran1502 May 18, 2024
d168b13
building out controller
alextran1502 May 18, 2024
86425ef
action button
alextran1502 May 19, 2024
7d7033f
UI work
alextran1502 May 19, 2024
659478d
color
alextran1502 May 20, 2024
f4e2e26
chip
alextran1502 May 20, 2024
89e3282
functionalities
alextran1502 May 20, 2024
7de0ab7
finish ui
alextran1502 May 20, 2024
468a80a
implemented functionality
alextran1502 May 21, 2024
dfdfff2
notification
alextran1502 May 21, 2024
621c6b5
merge main
alextran1502 May 21, 2024
824aff3
Single instance of duplication
alextran1502 May 21, 2024
3bfa0f4
merge main
alextran1502 May 21, 2024
310fd72
Update web/src/lib/components/admin-page/settings/machine-learning-se…
alextran1502 May 21, 2024
ecb08a3
pr feedback
alextran1502 May 21, 2024
bd6bc6c
Merge branch 'feat/web-duplication-detection-ui' of github.com:immich…
alextran1502 May 21, 2024
83256c1
pr feedback & openapi
alextran1502 May 21, 2024
50265fd
pr feedback and clean up
alextran1502 May 22, 2024
f8df214
merge main
alextran1502 May 22, 2024
ac940d8
using s
alextran1502 May 22, 2024
bc6b055
controller signature
alextran1502 May 22, 2024
91e577e
linting
alextran1502 May 22, 2024
2c161a0
merge main
alextran1502 May 22, 2024
aea6909
remove generated file from pr
alextran1502 May 22, 2024
5bca35a
refactor
alextran1502 May 22, 2024
c723db6
fix sort issue
alextran1502 May 22, 2024
b870524
pr feedback
alextran1502 May 22, 2024
d907a93
pr feedback done
alextran1502 May 23, 2024
bb48d3a
remove ignore openapi file
alextran1502 May 23, 2024
1a9d21b
remove ignore openapi file
alextran1502 May 23, 2024
e607958
pr feedback
alextran1502 May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
661 changes: 661 additions & 0 deletions mobile/openapi/.openapi-generator/FILES

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions mobile/openapi/README.md

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

1 change: 1 addition & 0 deletions mobile/openapi/lib/api.dart

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

44 changes: 44 additions & 0 deletions mobile/openapi/lib/api/duplicate_api.dart

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

2 changes: 2 additions & 0 deletions mobile/openapi/lib/api_client.dart

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

100 changes: 100 additions & 0 deletions mobile/openapi/lib/model/resolve_duplicates_dto.dart

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

31 changes: 31 additions & 0 deletions mobile/openapi/test/duplicate_api_test.dart

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

27 changes: 27 additions & 0 deletions mobile/openapi/test/resolve_duplicates_dto_test.dart

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

59 changes: 59 additions & 0 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,51 @@
]
}
},
"/duplicates/{id}/resolve": {
"post": {
"operationId": "resolveDuplicates",
"parameters": [
{
"name": "id",
"required": true,
"in": "path",
"schema": {
"format": "uuid",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResolveDuplicatesDto"
}
}
},
"required": true
},
"responses": {
"200": {
"description": ""
}
},
"security": [
{
"bearer": []
},
{
"cookie": []
},
{
"api_key": []
}
],
"tags": [
"Duplicate"
]
}
},
"/faces": {
"get": {
"operationId": "getFaces",
Expand Down Expand Up @@ -9249,6 +9294,20 @@
],
"type": "object"
},
"ResolveDuplicatesDto": {
"properties": {
"assetIds": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"assetIds"
],
"type": "object"
},
"ReverseGeocodingStateResponseDto": {
"properties": {
"lastImportFileName": {
Expand Down
13 changes: 13 additions & 0 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ export type DuplicateResponseDto = {
assets: AssetResponseDto[];
duplicateId: string;
};
export type ResolveDuplicatesDto = {
assetIds: string[];
};
export type PersonResponseDto = {
birthDate: string | null;
id: string;
Expand Down Expand Up @@ -1706,6 +1709,16 @@ export function getAssetDuplicates(opts?: Oazapfts.RequestOpts) {
...opts
}));
}
export function resolveDuplicates({ id, resolveDuplicatesDto }: {
id: string;
resolveDuplicatesDto: ResolveDuplicatesDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText(`/duplicates/${encodeURIComponent(id)}/resolve`, oazapfts.json({
...opts,
method: "POST",
body: resolveDuplicatesDto
})));
}
export function getFaces({ id }: {
id: string;
}, opts?: Oazapfts.RequestOpts) {
Expand Down
16 changes: 14 additions & 2 deletions server/src/controllers/duplicate.controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Controller, Get } from '@nestjs/common';
import { Body, Controller, Get, HttpCode, Param, Post } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { AuthDto } from 'src/dtos/auth.dto';
import { DuplicateResponseDto } from 'src/dtos/duplicate.dto';
import { DuplicateResponseDto, ResolveDuplicatesDto } from 'src/dtos/duplicate.dto';
import { Auth, Authenticated } from 'src/middleware/auth.guard';
import { DuplicateService } from 'src/services/duplicate.service';
import { UUIDParamDto } from 'src/validation';

@ApiTags('Duplicate')
@Controller('duplicates')
Expand All @@ -15,4 +16,15 @@ export class DuplicateController {
getAssetDuplicates(@Auth() auth: AuthDto): Promise<DuplicateResponseDto[]> {
return this.service.getDuplicates(auth);
}

@Post(':id/resolve')
@HttpCode(200)
@Authenticated()
resolveDuplicates(
@Auth() auth: AuthDto,
@Param() { id: duplicateId }: UUIDParamDto,
@Body() dto: ResolveDuplicatesDto,
): Promise<void> {
return this.service.resolveDuplicates(auth, duplicateId, dto);
}
}
6 changes: 6 additions & 0 deletions server/src/dtos/duplicate.dto.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IsNotEmpty } from 'class-validator';
import { groupBy } from 'lodash';
import { AssetResponseDto } from 'src/dtos/asset-response.dto';

Expand All @@ -6,6 +7,11 @@ export class DuplicateResponseDto {
assets!: AssetResponseDto[];
}

export class ResolveDuplicatesDto {
@IsNotEmpty()
assetIds!: string[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need @ValidateUUID({ each: true }) here

}

export function mapDuplicateResponse(assets: AssetResponseDto[]): DuplicateResponseDto[] {
const result = [];

Expand Down
Loading
Loading