Skip to content

Commit

Permalink
feat(assets): remove assetId in upsert (#326)
Browse files Browse the repository at this point in the history
* Updated typescript eslint parser
  • Loading branch information
Leagian authored and sebtiz13 committed Jan 16, 2024
1 parent ac061e1 commit 2f286de
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/modules/asset/AssetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ export class AssetService extends BaseService {
*/
public async upsert(
engineId: string,
assetId: string,
model: string,
reference: string,
metadata: Metadata,
request: KuzzleRequest
): Promise<KDocument<AssetContent>> {
const assetId = `${model}-${reference}`;
return lock(`asset:${engineId}:${assetId}`, async () => {
const asset = await this.get(engineId, assetId, request).catch(
() => null
Expand Down
2 changes: 0 additions & 2 deletions lib/modules/asset/AssetsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,12 @@ export class AssetsController {

async upsert(request: KuzzleRequest): Promise<ApiAssetUpsertResult> {
const engineId = request.getString("engineId");
const assetId = request.getId();
const model = request.getBodyString("model");
const reference = request.getBodyString("reference");
const metadata = request.getBodyObject("metadata");

const upsertAsset = await this.assetService.upsert(
engineId,
assetId,
model,
reference,
metadata,
Expand Down
1 change: 0 additions & 1 deletion lib/modules/shared/services/BaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
ArgsDocumentControllerCreate,
ArgsDocumentControllerDelete,
ArgsDocumentControllerUpdate,
ArgsDocumentControllerUpsert,
Backend,
BaseRequest,
DocumentSearchResult,
Expand Down
82 changes: 76 additions & 6 deletions package-lock.json

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

0 comments on commit 2f286de

Please sign in to comment.