@tagsamurai/fats-api-services 1.1.0-dev-alpha.7 → 1.1.0-dev-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-services.es.js +81 -0
- package/api-services.system.js +80 -0
- package/main.d.ts +1 -0
- package/package.json +1 -1
package/api-services.es.js
CHANGED
|
@@ -443,7 +443,88 @@ const ChangelogServices = {
|
|
|
443
443
|
return API.get(`/assignment-log/${userId}/options`, { params });
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
|
+
const AssetsAPIs = createAxiosInstance({
|
|
447
|
+
prefix: "/fam/assets/v2/assets"
|
|
448
|
+
});
|
|
449
|
+
const AssetServices = {
|
|
450
|
+
getAllAssets: (params) => {
|
|
451
|
+
return AssetsAPIs.get("/", { params });
|
|
452
|
+
},
|
|
453
|
+
getAllAssetsOptions: (params) => {
|
|
454
|
+
return AssetsAPIs.get("/options", { params });
|
|
455
|
+
},
|
|
456
|
+
getOptions: (endpoint, params) => {
|
|
457
|
+
return AssetsAPIs.get(endpoint ? `/${endpoint}/options` : "/options", {
|
|
458
|
+
params
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
getUnlinkedAssets: (params) => {
|
|
462
|
+
return AssetsAPIs.get("/unlinked", { params });
|
|
463
|
+
},
|
|
464
|
+
getAssetDetail: (id, params) => {
|
|
465
|
+
return AssetsAPIs.get(`/${id}`, { params });
|
|
466
|
+
},
|
|
467
|
+
getAssetNameTotal: () => {
|
|
468
|
+
return AssetsAPIs.get("/name-amount");
|
|
469
|
+
},
|
|
470
|
+
postRegisterAsset: (body) => {
|
|
471
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
472
|
+
return AssetsAPIs.post("", body, { headers });
|
|
473
|
+
},
|
|
474
|
+
putEditAsset: (id, body) => {
|
|
475
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
476
|
+
return AssetsAPIs.put(`/${id}`, body, { headers });
|
|
477
|
+
},
|
|
478
|
+
putEditDetailCustomField: (id, body) => {
|
|
479
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
480
|
+
return AssetsAPIs.put(`/${id}`, body, { headers });
|
|
481
|
+
},
|
|
482
|
+
getLinkedAsset: (assetId, params) => {
|
|
483
|
+
return AssetsAPIs.get(`/${assetId}/linked-assets`, { params });
|
|
484
|
+
},
|
|
485
|
+
getPurchase: (assetId) => {
|
|
486
|
+
return AssetsAPIs.get(`/${assetId}/purchase`);
|
|
487
|
+
},
|
|
488
|
+
putPurchase: (body, assetId) => {
|
|
489
|
+
return AssetsAPIs.put(`/${assetId}/purchase`, body);
|
|
490
|
+
},
|
|
491
|
+
getAccounting: (assetId, params) => {
|
|
492
|
+
return AssetsAPIs.get(`/${assetId}/accounting`, { params });
|
|
493
|
+
},
|
|
494
|
+
getLinkedAssetOption: (parentId, params) => {
|
|
495
|
+
return AssetsAPIs.get(`/${parentId}/linked-assets/options`, { params });
|
|
496
|
+
},
|
|
497
|
+
putLinkAsset: (body, parentId) => {
|
|
498
|
+
return AssetsAPIs.put(`/${parentId}/linked-assets`, body);
|
|
499
|
+
},
|
|
500
|
+
putUnlinkAsset: (body, parentId) => {
|
|
501
|
+
return AssetsAPIs.put(`/${parentId}/unlink-assets`, body);
|
|
502
|
+
},
|
|
503
|
+
putEditUsefulLife: (body) => {
|
|
504
|
+
return AssetsAPIs.put("/useful-life", body);
|
|
505
|
+
},
|
|
506
|
+
getAttachment: (assetId, params) => {
|
|
507
|
+
return AssetsAPIs.get(`/attachment/${assetId}`, { params });
|
|
508
|
+
},
|
|
509
|
+
postAttachment: (body, assetId) => {
|
|
510
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
511
|
+
return AssetsAPIs.post(`/attachment/${assetId}`, body, { headers });
|
|
512
|
+
},
|
|
513
|
+
putAttachment: (body, id) => {
|
|
514
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
515
|
+
return AssetsAPIs.put(`/attachment/${id}`, body, { headers });
|
|
516
|
+
},
|
|
517
|
+
/**
|
|
518
|
+
* Deletes the attachment with the given IDs.
|
|
519
|
+
* @param {object} params - The request params containing the IDs of the attachments to delete.
|
|
520
|
+
* @returns {Promise<AxiosResponse>}
|
|
521
|
+
*/
|
|
522
|
+
deleteAttachment: (params) => {
|
|
523
|
+
return AssetsAPIs.delete("/attachment/bulk", { params });
|
|
524
|
+
}
|
|
525
|
+
};
|
|
446
526
|
export {
|
|
527
|
+
AssetServices,
|
|
447
528
|
AuthServices,
|
|
448
529
|
ChangelogServices,
|
|
449
530
|
CustomFieldServices,
|
package/api-services.system.js
CHANGED
|
@@ -450,6 +450,86 @@ System.register(["axios"], function(exports, module) {
|
|
|
450
450
|
return API.get(`/assignment-log/${userId}/options`, { params });
|
|
451
451
|
}
|
|
452
452
|
});
|
|
453
|
+
const AssetsAPIs = createAxiosInstance({
|
|
454
|
+
prefix: "/fam/assets/v2/assets"
|
|
455
|
+
});
|
|
456
|
+
const AssetServices = exports("AssetServices", {
|
|
457
|
+
getAllAssets: (params) => {
|
|
458
|
+
return AssetsAPIs.get("/", { params });
|
|
459
|
+
},
|
|
460
|
+
getAllAssetsOptions: (params) => {
|
|
461
|
+
return AssetsAPIs.get("/options", { params });
|
|
462
|
+
},
|
|
463
|
+
getOptions: (endpoint, params) => {
|
|
464
|
+
return AssetsAPIs.get(endpoint ? `/${endpoint}/options` : "/options", {
|
|
465
|
+
params
|
|
466
|
+
});
|
|
467
|
+
},
|
|
468
|
+
getUnlinkedAssets: (params) => {
|
|
469
|
+
return AssetsAPIs.get("/unlinked", { params });
|
|
470
|
+
},
|
|
471
|
+
getAssetDetail: (id, params) => {
|
|
472
|
+
return AssetsAPIs.get(`/${id}`, { params });
|
|
473
|
+
},
|
|
474
|
+
getAssetNameTotal: () => {
|
|
475
|
+
return AssetsAPIs.get("/name-amount");
|
|
476
|
+
},
|
|
477
|
+
postRegisterAsset: (body) => {
|
|
478
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
479
|
+
return AssetsAPIs.post("", body, { headers });
|
|
480
|
+
},
|
|
481
|
+
putEditAsset: (id, body) => {
|
|
482
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
483
|
+
return AssetsAPIs.put(`/${id}`, body, { headers });
|
|
484
|
+
},
|
|
485
|
+
putEditDetailCustomField: (id, body) => {
|
|
486
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
487
|
+
return AssetsAPIs.put(`/${id}`, body, { headers });
|
|
488
|
+
},
|
|
489
|
+
getLinkedAsset: (assetId, params) => {
|
|
490
|
+
return AssetsAPIs.get(`/${assetId}/linked-assets`, { params });
|
|
491
|
+
},
|
|
492
|
+
getPurchase: (assetId) => {
|
|
493
|
+
return AssetsAPIs.get(`/${assetId}/purchase`);
|
|
494
|
+
},
|
|
495
|
+
putPurchase: (body, assetId) => {
|
|
496
|
+
return AssetsAPIs.put(`/${assetId}/purchase`, body);
|
|
497
|
+
},
|
|
498
|
+
getAccounting: (assetId, params) => {
|
|
499
|
+
return AssetsAPIs.get(`/${assetId}/accounting`, { params });
|
|
500
|
+
},
|
|
501
|
+
getLinkedAssetOption: (parentId, params) => {
|
|
502
|
+
return AssetsAPIs.get(`/${parentId}/linked-assets/options`, { params });
|
|
503
|
+
},
|
|
504
|
+
putLinkAsset: (body, parentId) => {
|
|
505
|
+
return AssetsAPIs.put(`/${parentId}/linked-assets`, body);
|
|
506
|
+
},
|
|
507
|
+
putUnlinkAsset: (body, parentId) => {
|
|
508
|
+
return AssetsAPIs.put(`/${parentId}/unlink-assets`, body);
|
|
509
|
+
},
|
|
510
|
+
putEditUsefulLife: (body) => {
|
|
511
|
+
return AssetsAPIs.put("/useful-life", body);
|
|
512
|
+
},
|
|
513
|
+
getAttachment: (assetId, params) => {
|
|
514
|
+
return AssetsAPIs.get(`/attachment/${assetId}`, { params });
|
|
515
|
+
},
|
|
516
|
+
postAttachment: (body, assetId) => {
|
|
517
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
518
|
+
return AssetsAPIs.post(`/attachment/${assetId}`, body, { headers });
|
|
519
|
+
},
|
|
520
|
+
putAttachment: (body, id) => {
|
|
521
|
+
const headers = { "Content-Type": "multipart/form-data" };
|
|
522
|
+
return AssetsAPIs.put(`/attachment/${id}`, body, { headers });
|
|
523
|
+
},
|
|
524
|
+
/**
|
|
525
|
+
* Deletes the attachment with the given IDs.
|
|
526
|
+
* @param {object} params - The request params containing the IDs of the attachments to delete.
|
|
527
|
+
* @returns {Promise<AxiosResponse>}
|
|
528
|
+
*/
|
|
529
|
+
deleteAttachment: (params) => {
|
|
530
|
+
return AssetsAPIs.delete("/attachment/bulk", { params });
|
|
531
|
+
}
|
|
532
|
+
});
|
|
453
533
|
}
|
|
454
534
|
};
|
|
455
535
|
});
|
package/main.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { default as RoleServices } from './src/services/role.service';
|
|
|
6
6
|
export { default as CustomFieldServices } from './src/services/customField.service';
|
|
7
7
|
export { default as AuthServices } from './src/services/moduleAuth.service';
|
|
8
8
|
export { default as ChangelogServices } from './src/services/log.service';
|
|
9
|
+
export { default as AssetServices } from './src/services/asset.service';
|
package/package.json
CHANGED