File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/core/infra/repositories Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,16 @@ export abstract class ApiRepository {
4747
4848 protected buildApiEndpoint (
4949 resourceName : string ,
50- operation : string ,
51- resourceId : number | string | undefined = undefined
50+ operation ? : string ,
51+ resourceId ? : number | string
5252 ) {
53+ const operationSegment = operation ? `/${ operation } ` : ''
54+
5355 return typeof resourceId === 'number'
54- ? `/${ resourceName } /${ resourceId } / ${ operation } `
56+ ? `/${ resourceName } /${ resourceId } ${ operationSegment } `
5557 : typeof resourceId === 'string'
56- ? `/${ resourceName } /:persistentId/ ${ operation } ?persistentId=${ resourceId } `
57- : `/${ resourceName } / ${ operation } `
58+ ? `/${ resourceName } /:persistentId${ operationSegment } ?persistentId=${ resourceId } `
59+ : `/${ resourceName } ${ operationSegment } `
5860 }
5961
6062 // eslint-disable-next-line @typescript-eslint/no-explicit-any
You can’t perform that action at this time.
0 commit comments