mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 01:11:20 +03:00
refactor(server): move checkExistingAssets(), checkBulkUpdate() remove getAllAssets() (#9715)
* Refactor controller methods, non-breaking change * Remove getAllAssets * used imports * sync:sql * missing mock * Removing remaining references * chore: remove unused code --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -969,109 +969,6 @@
|
||||
"Asset"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"description": "Get all AssetEntity belong to the user",
|
||||
"operationId": "getAllAssets",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "if-none-match",
|
||||
"in": "header",
|
||||
"description": "ETag of data already cached on the client",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "isArchived",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "isFavorite",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updatedAfter",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updatedBefore",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "userId",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/AssetResponseDto"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Asset"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "updateAssets",
|
||||
"parameters": [],
|
||||
|
||||
@@ -13,15 +13,14 @@ npm i --save @immich/sdk
|
||||
For a more detailed example, check out the [`@immich/cli`](https://github.com/immich-app/immich/tree/main/cli).
|
||||
|
||||
```typescript
|
||||
import { getAllAlbums, getAllAssets, getMyUserInfo, init } from "@immich/sdk";
|
||||
import { getAllAlbums, getMyUserInfo, init } from "@immich/sdk";
|
||||
|
||||
const API_KEY = "<API_KEY>"; // process.env.IMMICH_API_KEY
|
||||
|
||||
init({ baseUrl: "https://demo.immich.app/api", apiKey: API_KEY });
|
||||
|
||||
const user = await getMyUserInfo();
|
||||
const assets = await getAllAssets({ take: 1000 });
|
||||
const albums = await getAllAlbums({});
|
||||
|
||||
console.log({ user, assets, albums });
|
||||
console.log({ user, albums });
|
||||
```
|
||||
|
||||
@@ -1338,37 +1338,6 @@ export function deleteAssets({ assetBulkDeleteDto }: {
|
||||
body: assetBulkDeleteDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Get all AssetEntity belong to the user
|
||||
*/
|
||||
export function getAllAssets({ ifNoneMatch, isArchived, isFavorite, skip, take, updatedAfter, updatedBefore, userId }: {
|
||||
ifNoneMatch?: string;
|
||||
isArchived?: boolean;
|
||||
isFavorite?: boolean;
|
||||
skip?: number;
|
||||
take?: number;
|
||||
updatedAfter?: string;
|
||||
updatedBefore?: string;
|
||||
userId?: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: AssetResponseDto[];
|
||||
}>(`/asset${QS.query(QS.explode({
|
||||
isArchived,
|
||||
isFavorite,
|
||||
skip,
|
||||
take,
|
||||
updatedAfter,
|
||||
updatedBefore,
|
||||
userId
|
||||
}))}`, {
|
||||
...opts,
|
||||
headers: oazapfts.mergeHeaders(opts?.headers, {
|
||||
"if-none-match": ifNoneMatch
|
||||
})
|
||||
}));
|
||||
}
|
||||
export function updateAssets({ assetBulkUpdateDto }: {
|
||||
assetBulkUpdateDto: AssetBulkUpdateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
|
||||
Reference in New Issue
Block a user