Skip to content

Commit 3695328

Browse files
committed
cds v9 6
1 parent 576830b commit 3695328

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

example-cap-server/srv/service/check-service.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use strict";
22

3-
const cds = require("@sap/cds");
43
const toggles = require("@cap-js-community/feature-toggle-library");
54

65
const { CHECK_API_PRIORITY } = require("../feature");
@@ -13,8 +12,8 @@ const MEDIUM_BOUNDARY = 10;
1312
const HIGH_VALUE_RESPONSES = ["well done", "full success", "huzzah", "celebrations"];
1413
const HIGH_BOUNDARY = 100;
1514

16-
const priorityHandler = async (context) => {
17-
const { "CheckService.priority": priority } = (cds.context.model ?? cds.model).definitions;
15+
const priorityHandler = (srv) => async (context) => {
16+
const { "CheckService.priority": priority } = (context.model ?? srv.model).definitions;
1817
const isFtsToggled = Boolean(priority["@marked"]);
1918
const value = toggles.getFeatureValue(CHECK_API_PRIORITY, { user: context.user.id, tenant: context.tenant });
2019
const messages =
@@ -31,5 +30,5 @@ const priorityHandler = async (context) => {
3130

3231
module.exports = async (srv) => {
3332
const { priority } = srv.operations;
34-
srv.on(priority, priorityHandler);
33+
srv.on(priority, priorityHandler(srv));
3534
};

0 commit comments

Comments
 (0)