Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 committed Feb 4, 2025
1 parent a30cae4 commit df0b536
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 25 deletions.
8 changes: 8 additions & 0 deletions docs/docs/overview/comparison.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sidebar_position: 2
---

# Comparison

If you're new here and came from other asset self-hosting alternatives you might want to look at a comparison between Immich and your current solution.
Here you can see a [comparison between the various OpenSource Photo Libraries](https://meichthys.github.io/foss_photo_libraries/) including Immich.
39 changes: 37 additions & 2 deletions e2e/src/api/specs/person.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LoginResponseDto, PersonResponseDto } from '@immich/sdk';
import { getPerson, LoginResponseDto, PersonResponseDto } from '@immich/sdk';
import { uuidDto } from 'src/fixtures';
import { errorDto } from 'src/responses';
import { app, utils } from 'src/utils';
import { app, asBearerAuth, utils } from 'src/utils';
import request from 'supertest';
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';

Expand Down Expand Up @@ -203,6 +203,22 @@ describe('/people', () => {
birthDate: '1990-01-01T00:00:00.000Z',
});
});

it('should create a favorite person', async () => {
const { status, body } = await request(app)
.post(`/people`)
.set('Authorization', `Bearer ${admin.accessToken}`)
.send({
name: 'New Favorite Person',
isFavorite: true,
});
expect(status).toBe(201);
expect(body).toMatchObject({
id: expect.any(String),
name: 'New Favorite Person',
isFavorite: true,
});
});
});

describe('PUT /people/:id', () => {
Expand All @@ -216,6 +232,7 @@ describe('/people', () => {
{ key: 'name', type: 'string' },
{ key: 'featureFaceAssetId', type: 'string' },
{ key: 'isHidden', type: 'boolean value' },
{ key: 'isFavorite', type: 'boolean value' },
]) {
it(`should not allow null ${key}`, async () => {
const { status, body } = await request(app)
Expand Down Expand Up @@ -255,6 +272,24 @@ describe('/people', () => {
expect(status).toBe(200);
expect(body).toMatchObject({ birthDate: null });
});

it('should mark a person as favorite', async () => {
const person = await utils.createPerson(admin.accessToken, {
name: 'visible_person',
});

expect(person.isFavorite).toBe(false);

const { status, body } = await request(app)
.put(`/people/${person.id}`)
.set('Authorization', `Bearer ${admin.accessToken}`)
.send({ isFavorite: true });
expect(status).toBe(200);
expect(body).toMatchObject({ isFavorite: true });

const person2 = await getPerson({ id: person.id }, { headers: asBearerAuth(admin.accessToken) });
expect(person2).toMatchObject({ id: person.id, isFavorite: true });
});
});

describe('POST /people/:id/merge', () => {
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion mobile/openapi/lib/model/person_response_dto.dart

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

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

4 changes: 2 additions & 2 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10427,7 +10427,7 @@
"type": "string"
},
"isFavorite": {
"description": "This property was added in v1.124.0",
"description": "This property was added in v1.126.0",
"type": "boolean"
},
"isHidden": {
Expand Down Expand Up @@ -10508,7 +10508,7 @@
"type": "string"
},
"isFavorite": {
"description": "This property was added in v1.124.0",
"description": "This property was added in v1.126.0",
"type": "boolean"
},
"isHidden": {
Expand Down
4 changes: 2 additions & 2 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export type PersonWithFacesResponseDto = {
birthDate: string | null;
faces: AssetFaceWithoutPersonResponseDto[];
id: string;
/** This property was added in v1.124.0 */
/** This property was added in v1.126.0 */
isFavorite?: boolean;
isHidden: boolean;
name: string;
Expand Down Expand Up @@ -494,7 +494,7 @@ export type DuplicateResponseDto = {
export type PersonResponseDto = {
birthDate: string | null;
id: string;
/** This property was added in v1.124.0 */
/** This property was added in v1.126.0 */
isFavorite?: boolean;
isHidden: boolean;
name: string;
Expand Down
37 changes: 23 additions & 14 deletions server/src/db.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
* Please do not edit it manually.
*/

import type { ColumnType } from 'kysely';
import type { ColumnType } from "kysely";

export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[] ? U[] : ArrayTypeImpl<T>;
export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[]
? U[]
: ArrayTypeImpl<T>;

export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S[], I[], U[]> : T[];
export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S[], I[], U[]>
: T[];

export type AssetsStatusEnum = 'active' | 'deleted' | 'trashed';
export type AssetsStatusEnum = "active" | "deleted" | "trashed";

export type Generated<T> =
T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;

export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;

Expand All @@ -28,7 +33,7 @@ export type JsonPrimitive = boolean | number | string | null;

export type JsonValue = JsonArray | JsonObject | JsonPrimitive;

export type Sourcetype = 'exif' | 'machine-learning';
export type Sourcetype = "exif" | "machine-learning";

export type Timestamp = ColumnType<Date, Date | string, Date | string>;

Expand Down Expand Up @@ -323,11 +328,6 @@ export interface SocketIoAttachments {
payload: Buffer | null;
}

export interface SystemConfig {
key: string;
value: string | null;
}

export interface SystemMetadata {
key: string;
value: Json;
Expand All @@ -353,6 +353,15 @@ export interface TagsClosure {
id_descendant: string;
}

export interface TypeormMetadata {
database: string | null;
name: string | null;
schema: string | null;
table: string | null;
type: string;
value: string | null;
}

export interface UserMetadata {
key: string;
userId: string;
Expand Down Expand Up @@ -427,13 +436,13 @@ export interface DB {
shared_links: SharedLinks;
smart_search: SmartSearch;
socket_io_attachments: SocketIoAttachments;
system_config: SystemConfig;
system_metadata: SystemMetadata;
tag_asset: TagAsset;
tags: Tags;
tags_closure: TagsClosure;
typeorm_metadata: TypeormMetadata;
user_metadata: UserMetadata;
users: Users;
'vectors.pg_vector_index_stat': VectorsPgVectorIndexStat;
"vectors.pg_vector_index_stat": VectorsPgVectorIndexStat;
version_history: VersionHistory;
}
4 changes: 1 addition & 3 deletions server/src/dtos/person.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class PersonCreateDto {
@ValidateBoolean({ optional: true })
isHidden?: boolean;

@ApiProperty()
@ValidateBoolean({ optional: true })
isFavorite?: boolean;
}
Expand Down Expand Up @@ -101,8 +100,7 @@ export class PersonResponseDto {
isHidden!: boolean;
@PropertyLifecycle({ addedAt: 'v1.107.0' })
updatedAt?: Date;
@ApiProperty()
@PropertyLifecycle({ addedAt: 'v1.124.0' })
@PropertyLifecycle({ addedAt: 'v1.126.0' })
isFavorite?: boolean;
}

Expand Down

0 comments on commit df0b536

Please sign in to comment.