@@ -2,6 +2,7 @@ import axios from 'axios';
22import config from 'config' ;
33
44import { Action } from '../utils/enums/application' ;
5+ import { Problem , uuidValidateV4 } from '../utils' ;
56
67import type { AxiosInstance , AxiosRequestConfig } from 'axios' ;
78
@@ -48,31 +49,19 @@ const service = {
4849 } ,
4950
5051 /**
51- * @function getObject
5252 * Get an object
53- * @param { string } bearerToken The bearer token of the authorized user
54- * @param { string } objectId The id for the object to get
53+ * @param bearerToken The bearer token of the authorized user
54+ * @param objectId The id for the object to get
5555 */
5656 async getObject ( bearerToken : string , objectId : string ) {
57+ if ( ! uuidValidateV4 ( objectId ) ) {
58+ throw new Problem ( 422 , { detail : 'Invalid objectId parameter' } ) ;
59+ }
5760 const { status, headers, data } = await comsAxios ( {
5861 responseType : 'arraybuffer' ,
5962 headers : { Authorization : `Bearer ${ bearerToken } ` }
6063 } ) . get ( `/object/${ objectId } ` ) ;
6164 return { status, headers, data } ;
62- } ,
63-
64- /**
65- * @function getObjects
66- * Gets a list of objects
67- * @param {string } bearerToken The bearer token of the authorized user
68- * @param {string[] } objectIds Array of object ids to get
69- */
70- async getObjects ( bearerToken : string , objectIds : Array < string > ) {
71- const { data } = await comsAxios ( { headers : { Authorization : `Bearer ${ bearerToken } ` } } ) . get ( '/object' , {
72- params : { objectId : objectIds }
73- } ) ;
74-
75- return data ;
7665 }
7766} ;
7867
0 commit comments