Zammad send fixes, update deps
This commit is contained in:
parent
c47223f5e9
commit
a4053e6412
29 changed files with 626 additions and 500 deletions
|
|
@ -20,7 +20,7 @@
|
|||
"@babel/preset-typescript": "7.24.7",
|
||||
"prettier": "^3.3.3",
|
||||
"@link-stack/typescript-config": "*",
|
||||
"tsx": "^4.16.5",
|
||||
"tsx": "^4.17.0",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,12 @@ export class Service {
|
|||
req: NextRequest,
|
||||
{ params: { service, token } }: ServiceParams,
|
||||
): Promise<NextResponse> {
|
||||
const table = getServiceTable(service);
|
||||
const row = await db
|
||||
.selectFrom(table)
|
||||
.selectAll()
|
||||
.where("token", "=", token ?? "NEVER_MATCH")
|
||||
.executeTakeFirstOrThrow();
|
||||
const json = await req.json();
|
||||
const worker = await getWorkerUtils();
|
||||
await worker.addJob(`${service}/send-${service}-message`, {
|
||||
|
|
@ -88,7 +94,17 @@ export class Service {
|
|||
...json,
|
||||
});
|
||||
|
||||
return NextResponse.json({ response: "ok" });
|
||||
const response = {
|
||||
response: "ok",
|
||||
result: {
|
||||
to: json.to,
|
||||
from: row?.phoneNumber ?? null,
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
};
|
||||
|
||||
console.log(response);
|
||||
return NextResponse.json(response);
|
||||
}
|
||||
|
||||
async receiveMessage(
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
"@link-stack/signal-api": "*",
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^7.12.0",
|
||||
"@mui/x-date-pickers-pro": "^7.12.0",
|
||||
"@mui/x-data-grid-pro": "^7.12.1",
|
||||
"@mui/x-date-pickers-pro": "^7.12.1",
|
||||
"date-fns": "^3.6.0",
|
||||
"kysely": "0.26.1",
|
||||
"material-ui-popup-state": "^5.1.2",
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/node": "^22.2.0",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@rushstack/eslint-patch": "^1.10.4",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.1",
|
||||
"@typescript-eslint/parser": "^8.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
||||
"@typescript-eslint/parser": "^8.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-xo-space": "^0.35.0",
|
||||
"eslint-plugin-cypress": "^3.4.0",
|
||||
"eslint-plugin-cypress": "^3.5.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jest": "^28.7.0",
|
||||
"eslint-plugin-jest": "^28.8.0",
|
||||
"eslint-plugin-promise": "^7.1.0",
|
||||
"eslint-plugin-unicorn": "55.0.0",
|
||||
"@babel/eslint-parser": "7.25.1"
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
"@emotion/styled": "^11.13.0",
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^7.12.0",
|
||||
"@mui/x-date-pickers-pro": "^7.12.0",
|
||||
"@mui/x-data-grid-pro": "^7.12.1",
|
||||
"@mui/x-date-pickers-pro": "^7.12.1",
|
||||
"@link-stack/opensearch-common": "*",
|
||||
"date-fns": "^3.6.0",
|
||||
"material-ui-popup-state": "^5.1.2",
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/node": "^22.2.0",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/node": "^22.2.0",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
"dependencies": {
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^7.12.0",
|
||||
"@mui/x-date-pickers-pro": "^7.12.0",
|
||||
"@mui/x-data-grid-pro": "^7.12.1",
|
||||
"@mui/x-date-pickers-pro": "^7.12.1",
|
||||
"next": "14.2.5",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/node": "^22.2.0",
|
||||
"@types/react": "18.3.3",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,16 +61,16 @@ class CommunicateCdrSignalJob < ApplicationJob
|
|||
|
||||
return if has_error
|
||||
|
||||
article.to = result['result']['recipient']
|
||||
article.from = result['result']['source']
|
||||
article.to = result['result']['to']
|
||||
article.from = result['result']['from']
|
||||
|
||||
message_id = format('%<source>s@%<timestamp>s', source: result['result']['source'],
|
||||
message_id = format('%<from>s@%<timestamp>s', from: result['result']['from'],
|
||||
timestamp: result['result']['timestamp'])
|
||||
article.preferences['cdr_signal'] = {
|
||||
timestamp: result['result']['timestamp'],
|
||||
message_id: message_id,
|
||||
from: result['result']['source'],
|
||||
to: result['result']['recipient']
|
||||
from: result['result']['from'],
|
||||
to: result['result']['to']
|
||||
}
|
||||
|
||||
# set delivery status
|
||||
|
|
|
|||
|
|
@ -61,16 +61,16 @@ class CommunicateCdrWhatsappJob < ApplicationJob
|
|||
|
||||
return if has_error
|
||||
|
||||
article.to = result['result']['recipient']
|
||||
article.from = result['result']['source']
|
||||
article.to = result['result']['to']
|
||||
article.from = result['result']['from']
|
||||
|
||||
message_id = format('%<source>s@%<timestamp>s', source: result['result']['source'],
|
||||
message_id = format('%<from>s@%<timestamp>s', from: result['result']['from'],
|
||||
timestamp: result['result']['timestamp'])
|
||||
article.preferences['cdr_whatsapp'] = {
|
||||
timestamp: result['result']['timestamp'],
|
||||
message_id: message_id,
|
||||
from: result['result']['source'],
|
||||
to: result['result']['recipient']
|
||||
from: result['result']['from'],
|
||||
to: result['result']['to']
|
||||
}
|
||||
|
||||
# set delivery status
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class CdrSignal
|
|||
end
|
||||
|
||||
def self.message_id(message_raw)
|
||||
format('%<source>s@%<timestamp>s', source: message_raw['source'], timestamp: message_raw['timestamp'])
|
||||
format('%<from>s@%<timestamp>s', from: message_raw['from'], timestamp: message_raw['timestamp'])
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class CdrWhatsapp
|
|||
end
|
||||
|
||||
def self.message_id(message_raw)
|
||||
format('%<source>s@%<timestamp>s', source: message_raw['source'], timestamp: message_raw['timestamp'])
|
||||
format('%<from>s@%<timestamp>s', from: message_raw['from'], timestamp: message_raw['timestamp'])
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue