Skip to content

Commit c428eea

Browse files
authored
feat(api7): add route priority support (#170)
1 parent 6a8857c commit c428eea

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

libs/backend-api7/e2e/sync-and-dump-1.e2e-spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ describe('Sync and Dump - 1', () => {
117117
const route1 = {
118118
name: route1Name,
119119
uris: ['/route1'],
120+
priority: 100,
120121
} as ADCSDK.Route;
121122
const route2Name = 'route2';
122123
const route2 = {

libs/backend-api7/src/transformer.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class ToADC {
2424
methods: route.methods,
2525
enable_websocket: route.enable_websocket,
2626
plugins: route.plugins,
27+
priority: route.priority,
2728
metadata: { id: route.route_id },
2829
});
2930
}
@@ -117,7 +118,7 @@ export class FromADC {
117118
}
118119

119120
public transformRoute(route: ADCSDK.Route, serviceId: string): typing.Route {
120-
return ADCSDK.utils.recursiveOmitUndefined({
121+
return ADCSDK.utils.recursiveOmitUndefined<typing.Route>({
121122
route_id: ADCSDK.utils.generateId(route.name),
122123
name: route.name,
123124
desc: route.description,
@@ -127,6 +128,7 @@ export class FromADC {
127128
plugins: route.plugins,
128129
service_id: serviceId,
129130
paths: [route.uris[0]],
131+
priority: route.priority,
130132
});
131133
}
132134

libs/backend-api7/src/typing.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface Route {
2828

2929
// misc
3030
enable_websocket?: boolean;
31+
priority?: number;
3132
}
3233
export interface StreamRoute {
3334
id?: string;

0 commit comments

Comments
 (0)