mirror of
https://github.com/samsonjs/immich.git
synced 2026-03-25 09:15:56 +00:00
chore: removed unused endpoint (#16167)
This commit is contained in:
parent
2c88ce8559
commit
7c26663013
15 changed files with 2 additions and 207 deletions
|
|
@ -23,7 +23,6 @@ class ApiService implements Authentication {
|
|||
late MapApi mapApi;
|
||||
late PartnersApi partnersApi;
|
||||
late PeopleApi peopleApi;
|
||||
late AuditApi auditApi;
|
||||
late SharedLinksApi sharedLinksApi;
|
||||
late SyncApi syncApi;
|
||||
late SystemConfigApi systemConfigApi;
|
||||
|
|
@ -56,7 +55,6 @@ class ApiService implements Authentication {
|
|||
mapApi = MapApi(_apiClient);
|
||||
partnersApi = PartnersApi(_apiClient);
|
||||
peopleApi = PeopleApi(_apiClient);
|
||||
auditApi = AuditApi(_apiClient);
|
||||
sharedLinksApi = SharedLinksApi(_apiClient);
|
||||
syncApi = SyncApi(_apiClient);
|
||||
systemConfigApi = SystemConfigApi(_apiClient);
|
||||
|
|
|
|||
BIN
mobile/openapi/README.md
generated
BIN
mobile/openapi/README.md
generated
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
|||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
BIN
mobile/openapi/lib/api.dart
generated
BIN
mobile/openapi/lib/api.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/api/audit_api.dart
generated
BIN
mobile/openapi/lib/api/audit_api.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/api_client.dart
generated
BIN
mobile/openapi/lib/api_client.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/api_helper.dart
generated
BIN
mobile/openapi/lib/api_helper.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/model/audit_deletes_response_dto.dart
generated
BIN
mobile/openapi/lib/model/audit_deletes_response_dto.dart
generated
Binary file not shown.
BIN
mobile/openapi/lib/model/entity_type.dart
generated
BIN
mobile/openapi/lib/model/entity_type.dart
generated
Binary file not shown.
|
|
@ -2079,65 +2079,6 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/audit/deletes": {
|
||||
"get": {
|
||||
"operationId": "getAuditDeletes",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "after",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "entityType",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/EntityType"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "userId",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuditDeletesResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Audit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/auth/admin-sign-up": {
|
||||
"post": {
|
||||
"operationId": "signUpAdmin",
|
||||
|
|
@ -8643,24 +8584,6 @@
|
|||
],
|
||||
"type": "string"
|
||||
},
|
||||
"AuditDeletesResponseDto": {
|
||||
"properties": {
|
||||
"ids": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"needsFullSync": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ids",
|
||||
"needsFullSync"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"AvatarResponse": {
|
||||
"properties": {
|
||||
"color": {
|
||||
|
|
@ -9075,13 +8998,6 @@
|
|||
},
|
||||
"type": "object"
|
||||
},
|
||||
"EntityType": {
|
||||
"enum": [
|
||||
"ASSET",
|
||||
"ALBUM"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ExifResponseDto": {
|
||||
"properties": {
|
||||
"city": {
|
||||
|
|
|
|||
|
|
@ -449,10 +449,6 @@ export type AssetMediaReplaceDto = {
|
|||
fileCreatedAt: string;
|
||||
fileModifiedAt: string;
|
||||
};
|
||||
export type AuditDeletesResponseDto = {
|
||||
ids: string[];
|
||||
needsFullSync: boolean;
|
||||
};
|
||||
export type SignUpDto = {
|
||||
email: string;
|
||||
name: string;
|
||||
|
|
@ -1913,22 +1909,6 @@ export function playAssetVideo({ id, key }: {
|
|||
...opts
|
||||
}));
|
||||
}
|
||||
export function getAuditDeletes({ after, entityType, userId }: {
|
||||
after: string;
|
||||
entityType: EntityType;
|
||||
userId?: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AuditDeletesResponseDto;
|
||||
}>(`/audit/deletes${QS.query(QS.explode({
|
||||
after,
|
||||
entityType,
|
||||
userId
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function signUpAdmin({ signUpDto }: {
|
||||
signUpDto: SignUpDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
|
|
@ -3499,10 +3479,6 @@ export enum AssetMediaSize {
|
|||
Preview = "preview",
|
||||
Thumbnail = "thumbnail"
|
||||
}
|
||||
export enum EntityType {
|
||||
Asset = "ASSET",
|
||||
Album = "ALBUM"
|
||||
}
|
||||
export enum ManualJobName {
|
||||
PersonCleanup = "person-cleanup",
|
||||
TagCleanup = "tag-cleanup",
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
import { Controller, Get, Query } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { AuditDeletesDto, AuditDeletesResponseDto } from 'src/dtos/audit.dto';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
||||
import { AuditService } from 'src/services/audit.service';
|
||||
|
||||
@ApiTags('Audit')
|
||||
@Controller('audit')
|
||||
export class AuditController {
|
||||
constructor(private service: AuditService) {}
|
||||
|
||||
@Get('deletes')
|
||||
@Authenticated()
|
||||
getAuditDeletes(@Auth() auth: AuthDto, @Query() dto: AuditDeletesDto): Promise<AuditDeletesResponseDto> {
|
||||
return this.service.getDeletes(auth, dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import { APIKeyController } from 'src/controllers/api-key.controller';
|
|||
import { AppController } from 'src/controllers/app.controller';
|
||||
import { AssetMediaController } from 'src/controllers/asset-media.controller';
|
||||
import { AssetController } from 'src/controllers/asset.controller';
|
||||
import { AuditController } from 'src/controllers/audit.controller';
|
||||
import { AuthController } from 'src/controllers/auth.controller';
|
||||
import { DownloadController } from 'src/controllers/download.controller';
|
||||
import { DuplicateController } from 'src/controllers/duplicate.controller';
|
||||
|
|
@ -40,7 +39,6 @@ export const controllers = [
|
|||
AppController,
|
||||
AssetController,
|
||||
AssetMediaController,
|
||||
AuditController,
|
||||
AuthController,
|
||||
DownloadController,
|
||||
DuplicateController,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,7 @@
|
|||
import { BadRequestException } from '@nestjs/common';
|
||||
import { FileReportItemDto } from 'src/dtos/audit.dto';
|
||||
import {
|
||||
AssetFileType,
|
||||
AssetPathType,
|
||||
DatabaseAction,
|
||||
EntityType,
|
||||
JobStatus,
|
||||
PersonPathType,
|
||||
UserPathType,
|
||||
} from 'src/enum';
|
||||
import { AssetFileType, AssetPathType, JobStatus, PersonPathType, UserPathType } from 'src/enum';
|
||||
import { AuditService } from 'src/services/audit.service';
|
||||
import { auditStub } from 'test/fixtures/audit.stub';
|
||||
import { authStub } from 'test/fixtures/auth.stub';
|
||||
import { newTestService, ServiceMocks } from 'test/utils';
|
||||
|
||||
describe(AuditService.name, () => {
|
||||
|
|
@ -33,40 +23,6 @@ describe(AuditService.name, () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('getDeletes', () => {
|
||||
it('should require full sync if the request is older than 100 days', async () => {
|
||||
mocks.audit.getAfter.mockResolvedValue([]);
|
||||
|
||||
const date = new Date(2022, 0, 1);
|
||||
await expect(sut.getDeletes(authStub.admin, { after: date, entityType: EntityType.ASSET })).resolves.toEqual({
|
||||
needsFullSync: true,
|
||||
ids: [],
|
||||
});
|
||||
|
||||
expect(mocks.audit.getAfter).toHaveBeenCalledWith(date, {
|
||||
action: DatabaseAction.DELETE,
|
||||
userIds: [authStub.admin.user.id],
|
||||
entityType: EntityType.ASSET,
|
||||
});
|
||||
});
|
||||
|
||||
it('should get any new or updated assets and deleted ids', async () => {
|
||||
mocks.audit.getAfter.mockResolvedValue([auditStub.delete.entityId]);
|
||||
|
||||
const date = new Date();
|
||||
await expect(sut.getDeletes(authStub.admin, { after: date, entityType: EntityType.ASSET })).resolves.toEqual({
|
||||
needsFullSync: false,
|
||||
ids: ['asset-deleted'],
|
||||
});
|
||||
|
||||
expect(mocks.audit.getAfter).toHaveBeenCalledWith(date, {
|
||||
action: DatabaseAction.DELETE,
|
||||
userIds: [authStub.admin.user.id],
|
||||
entityType: EntityType.ASSET,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getChecksums', () => {
|
||||
it('should fail if the file is not in the immich path', async () => {
|
||||
await expect(sut.getChecksums({ filenames: ['foo/bar'] })).rejects.toBeInstanceOf(BadRequestException);
|
||||
|
|
|
|||
|
|
@ -4,22 +4,12 @@ import { resolve } from 'node:path';
|
|||
import { AUDIT_LOG_MAX_DURATION, JOBS_ASSET_PAGINATION_SIZE } from 'src/constants';
|
||||
import { StorageCore } from 'src/cores/storage.core';
|
||||
import { OnJob } from 'src/decorators';
|
||||
import {
|
||||
AuditDeletesDto,
|
||||
AuditDeletesResponseDto,
|
||||
FileChecksumDto,
|
||||
FileChecksumResponseDto,
|
||||
FileReportItemDto,
|
||||
PathEntityType,
|
||||
} from 'src/dtos/audit.dto';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import { FileChecksumDto, FileChecksumResponseDto, FileReportItemDto, PathEntityType } from 'src/dtos/audit.dto';
|
||||
import {
|
||||
AssetFileType,
|
||||
AssetPathType,
|
||||
DatabaseAction,
|
||||
JobName,
|
||||
JobStatus,
|
||||
Permission,
|
||||
PersonPathType,
|
||||
QueueName,
|
||||
StorageFolder,
|
||||
|
|
@ -37,24 +27,6 @@ export class AuditService extends BaseService {
|
|||
return JobStatus.SUCCESS;
|
||||
}
|
||||
|
||||
async getDeletes(auth: AuthDto, dto: AuditDeletesDto): Promise<AuditDeletesResponseDto> {
|
||||
const userId = dto.userId || auth.user.id;
|
||||
await this.requireAccess({ auth, permission: Permission.TIMELINE_READ, ids: [userId] });
|
||||
|
||||
const audits = await this.auditRepository.getAfter(dto.after, {
|
||||
userIds: [userId],
|
||||
entityType: dto.entityType,
|
||||
action: DatabaseAction.DELETE,
|
||||
});
|
||||
|
||||
const duration = DateTime.now().diff(DateTime.fromJSDate(dto.after));
|
||||
|
||||
return {
|
||||
needsFullSync: duration > AUDIT_LOG_MAX_DURATION,
|
||||
ids: audits,
|
||||
};
|
||||
}
|
||||
|
||||
async getChecksums(dto: FileChecksumDto) {
|
||||
const results: FileChecksumResponseDto[] = [];
|
||||
for (const filename of dto.filenames) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue