mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-18 23:52:52 +00:00
refactor: rename urlFragment in routes
This commit is contained in:
@@ -78,9 +78,9 @@ export interface SCRoute {
|
||||
statusCodeSuccess: number;
|
||||
|
||||
/**
|
||||
* URL fragment of the route
|
||||
* URL path of the route
|
||||
*/
|
||||
urlFragment: string;
|
||||
urlPath: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,16 +112,16 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
*/
|
||||
statusCodeSuccess = 200;
|
||||
/**
|
||||
* @see SCRoute.urlFragment
|
||||
* @see SCRoute.urlPath
|
||||
*/
|
||||
urlFragment = '/';
|
||||
urlPath = '/';
|
||||
|
||||
/**
|
||||
* Get "compiled" URL fragment
|
||||
* Get "compiled" URL path
|
||||
*
|
||||
* @param parameters Parameters to compile URL fragment with
|
||||
* @param parameters Parameters to compile URL path with
|
||||
*/
|
||||
public getUrlFragment(parameters: SCMap<string> = {}): string {
|
||||
public getUrlPath(parameters: SCMap<string> = {}): string {
|
||||
let obligatoryParameters: string[] = [];
|
||||
|
||||
if (typeof this.obligatoryParameters === 'object') {
|
||||
@@ -132,7 +132,7 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
throw new Error('Extraneous parameters provided.');
|
||||
}
|
||||
|
||||
return this.urlFragment
|
||||
return this.urlPath
|
||||
.split('/')
|
||||
.map((part) => {
|
||||
if (part.indexOf(':') !== 0) {
|
||||
|
||||
@@ -89,6 +89,6 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCBookAvailabilityRequest';
|
||||
this.responseBodyName = 'SCBookAvailabilityResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/bookAvailability';
|
||||
this.urlPath = '/bookAvailability';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ export class SCBulkAddRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCBulkAddRequest';
|
||||
this.responseBodyName = 'SCBulkAddResponse';
|
||||
this.statusCodeSuccess = StatusCodes.CREATED;
|
||||
this.urlFragment = '/bulk/:UID';
|
||||
this.urlPath = '/bulk/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCBulkDoneRequest';
|
||||
this.responseBodyName = 'SCBulkDoneResponse';
|
||||
this.statusCodeSuccess = StatusCodes.NO_CONTENT;
|
||||
this.urlFragment = '/bulk/:UID/done';
|
||||
this.urlPath = '/bulk/:UID/done';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,6 @@ export class SCBulkRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCBulkRequest';
|
||||
this.responseBodyName = 'SCBulkResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/bulk';
|
||||
this.urlPath = '/bulk';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCFeedbackRequest';
|
||||
this.responseBodyName = 'SCFeedbackResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/feedback';
|
||||
this.urlPath = '/feedback';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,6 @@ export class SCIndexRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCIndexRequest';
|
||||
this.responseBodyName = 'SCIndexResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/';
|
||||
this.urlPath = '/';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,6 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/plugin/register';
|
||||
this.urlPath = '/plugin/register';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,6 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCMultiSearchRequest';
|
||||
this.responseBodyName = 'SCMultiSearchResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/search/multi';
|
||||
this.urlPath = '/search/multi';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ export class SCSearchRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCSearchRequest';
|
||||
this.responseBodyName = 'SCSearchResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/search';
|
||||
this.urlPath = '/search';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
|
||||
this.requestBodyName = 'SCThingUpdateRequest';
|
||||
this.responseBodyName = 'SCThingUpdateResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlFragment = '/:TYPE/:UID';
|
||||
this.urlPath = '/:TYPE/:UID';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user