Skip to content

Commit

Permalink
fix: checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 committed Mar 18, 2024
1 parent 2821ace commit 6314ded
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
3 changes: 3 additions & 0 deletions server/e2e/jobs/specs/library-watcher.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe(`Library watcher (e2e)`, () => {
describe('Single import path', () => {
beforeEach(async () => {
await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -133,6 +134,7 @@ describe(`Library watcher (e2e)`, () => {
await fs.mkdir(`${IMMICH_TEST_ASSET_TEMP_PATH}/dir3`, { recursive: true });

await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [
`${IMMICH_TEST_ASSET_TEMP_PATH}/dir1`,
Expand Down Expand Up @@ -190,6 +192,7 @@ describe(`Library watcher (e2e)`, () => {

beforeEach(async () => {
library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [
`${IMMICH_TEST_ASSET_TEMP_PATH}/dir1`,
Expand Down
11 changes: 9 additions & 2 deletions server/e2e/jobs/specs/library.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LibraryResponseDto, LoginResponseDto } from '@app/domain';
import { LoginResponseDto } from '@app/domain';
import { LibraryController } from '@app/immich';
import { AssetType, LibraryType } from '@app/infra/entities';
import { LibraryType } from '@app/infra/entities';
import { errorStub, uuidStub } from '@test/fixtures';
import * as fs from 'node:fs';
import request from 'supertest';
Expand Down Expand Up @@ -41,6 +41,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
});

const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -72,6 +73,7 @@ describe(`${LibraryController.name} (e2e)`, () => {

it('should scan new files', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -107,6 +109,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
describe('with refreshModifiedFiles=true', () => {
it('should reimport modified files', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -153,6 +156,7 @@ describe(`${LibraryController.name} (e2e)`, () => {

it('should not reimport unmodified files', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -192,6 +196,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
describe('with refreshAllFiles=true', () => {
it('should reimport all files', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand Down Expand Up @@ -251,6 +256,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
});

const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_TEMP_PATH}`],
});
Expand All @@ -277,6 +283,7 @@ describe(`${LibraryController.name} (e2e)`, () => {

it('should not remove online files', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
ownerId: admin.userId,
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_PATH}/albums/nature`],
});
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"coverageDirectory": "./coverage",
"coverageThreshold": {
"./src/domain/": {
"branches": 79,
"branches": 75,
"functions": 80,
"lines": 90,
"statements": 90
Expand Down
10 changes: 0 additions & 10 deletions server/src/infra/sql/access.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ WHERE
)
AND ("LibraryEntity"."deletedAt" IS NULL)

-- AccessRepository.library.checkPartnerAccess
SELECT
"partner"."sharedById" AS "partner_sharedById",
"partner"."sharedWithId" AS "partner_sharedWithId"
FROM
"partners" "partner"
WHERE
"partner"."sharedById" IN ($1)
AND "partner"."sharedWithId" = $2

-- AccessRepository.person.checkOwnerAccess
SELECT
"PersonEntity"."id" AS "PersonEntity_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const dispatch = createEventDispatcher<{
cancel: void;
submit: { ownerId: string | null };
submit: { ownerId: string };
delete: void;
}>();
Expand Down
10 changes: 2 additions & 8 deletions web/src/routes/admin/library-management/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
removeOfflineFiles,
scanLibrary,
updateLibrary,
type CreateLibraryDto,
type LibraryResponseDto,
type LibraryStatsResponseDto,
type UserResponseDto,
Expand Down Expand Up @@ -117,14 +116,9 @@
}
}
const handleCreate = async (ownerId: string | null) => {
const handleCreate = async (ownerId: string) => {
try {
let createLibraryDto: CreateLibraryDto = { type: LibraryType.External };
if (ownerId) {
createLibraryDto = { ...createLibraryDto, ownerId };
}
const createdLibrary = await createLibrary({ createLibraryDto });
const createdLibrary = await createLibrary({ createLibraryDto: { ownerId, type: LibraryType.External } });
notificationController.show({
message: `Created library: ${createdLibrary.name}`,
Expand Down

0 comments on commit 6314ded

Please sign in to comment.