Zammad send fixes, update deps

This commit is contained in:
Darren Clarke 2024-08-14 10:51:12 +02:00
parent c47223f5e9
commit a4053e6412
29 changed files with 626 additions and 500 deletions

View file

@ -20,8 +20,8 @@
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/material-nextjs": "^5.16.6", "@mui/material-nextjs": "^5.16.6",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"@mui/x-license": "^7.12.0", "@mui/x-license": "^7.12.0",
"@link-stack/bridge-common": "*", "@link-stack/bridge-common": "*",
"@link-stack/bridge-ui": "*", "@link-stack/bridge-ui": "*",
@ -43,7 +43,7 @@
"react-timer-hook": "^3.0.7", "react-timer-hook": "^3.0.7",
"sharp": "^0.33.4", "sharp": "^0.33.4",
"tss-react": "^4.9.12", "tss-react": "^4.9.12",
"tsx": "^4.16.5", "tsx": "^4.17.0",
"@link-stack/ui": "*" "@link-stack/ui": "*"
}, },
"devDependencies": { "devDependencies": {

View file

@ -12,7 +12,7 @@
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"kysely": "0.26.1", "kysely": "0.26.1",
"pg": "^8.12.0", "pg": "^8.12.0",
"tsx": "^4.16.5" "tsx": "^4.17.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22", "@types/node": "^22",

View file

@ -20,7 +20,7 @@
"@link-stack/typescript-config": "*", "@link-stack/typescript-config": "*",
"@types/node": "*", "@types/node": "*",
"dotenv-cli": "^7.4.2", "dotenv-cli": "^7.4.2",
"tsx": "^4.16.5", "tsx": "^4.17.0",
"typescript": "^5.5.4" "typescript": "^5.5.4"
}, },
"scripts": { "scripts": {

View file

@ -20,7 +20,7 @@
"jest": "^29.7.0", "jest": "^29.7.0",
"kysely": "^0.27.3", "kysely": "^0.27.3",
"pg": "^8.12.0", "pg": "^8.12.0",
"remeda": "^2.10.0", "remeda": "^2.11.0",
"twilio": "^5.2.2" "twilio": "^5.2.2"
}, },
"devDependencies": { "devDependencies": {

View file

@ -142,7 +142,7 @@ const sendToLeafcutter = async (tickets: LabelStudioTicket[]) => {
}, },
body: JSON.stringify({ tickets: finalTickets }), body: JSON.stringify({ tickets: finalTickets }),
}); });
console.log({ result });
}; };
*/ */
const importLeafcutterTask = async (): Promise<void> => { const importLeafcutterTask = async (): Promise<void> => {

View file

@ -22,8 +22,8 @@
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/material-nextjs": "^5.16.6", "@mui/material-nextjs": "^5.16.6",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"@opensearch-project/opensearch": "^2.11.0", "@opensearch-project/opensearch": "^2.11.0",
"cryptr": "^6.3.0", "cryptr": "^6.3.0",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
@ -43,7 +43,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",

View file

@ -59,7 +59,6 @@ export const TicketCreateDialog: FC<TicketCreateDialogProps> = ({
useEffect(() => { useEffect(() => {
const fetchUsers = async () => { const fetchUsers = async () => {
const result = await getCustomersAction(); const result = await getCustomersAction();
console.log({ result });
setCustomers(result); setCustomers(result);
}; };

View file

@ -3,6 +3,7 @@
import { executeREST } from "app/_lib/zammad"; import { executeREST } from "app/_lib/zammad";
export const getGroupsAction = async () => { export const getGroupsAction = async () => {
try {
const groups = await executeREST({ const groups = await executeREST({
path: "/api/v1/groups", path: "/api/v1/groups",
}); });
@ -13,4 +14,8 @@ export const getGroupsAction = async () => {
})); }));
return formattedGroups; return formattedGroups;
} catch (e) {
console.error(e);
return [];
}
}; };

View file

@ -16,6 +16,7 @@ const overviewLookup = {
}; };
export const getOverviewTicketCountsAction = async () => { export const getOverviewTicketCountsAction = async () => {
try {
const recent = await executeREST({ path: "/api/v1/recent_view" }); const recent = await executeREST({ path: "/api/v1/recent_view" });
const countResult = await executeGraphQL({ const countResult = await executeGraphQL({
query: getTicketOverviewCountsQuery, query: getTicketOverviewCountsQuery,
@ -34,12 +35,16 @@ export const getOverviewTicketCountsAction = async () => {
counts.recent = recent.length; counts.recent = recent.length;
return counts; return counts;
} catch (e) {
console.error(e);
return {};
}
}; };
export const getOverviewTicketsAction = async (name: string) => { export const getOverviewTicketsAction = async (name: string) => {
let tickets = []; let tickets = [];
let error = null;
try {
if (name === "Recent") { if (name === "Recent") {
const recent = await executeREST({ path: "/api/v1/recent_view" }); const recent = await executeREST({ path: "/api/v1/recent_view" });
@ -63,8 +68,6 @@ export const getOverviewTicketsAction = async (name: string) => {
(overview: any) => overview.node.name === fullName, (overview: any) => overview.node.name === fullName,
)?.node?.id; )?.node?.id;
console.log({ overviewID });
const ticketsResult = await executeGraphQL({ const ticketsResult = await executeGraphQL({
query: getTicketsByOverviewQuery, query: getTicketsByOverviewQuery,
variables: { overviewId: overviewID, pageSize: 250 }, variables: { overviewId: overviewID, pageSize: 250 },
@ -86,5 +89,9 @@ export const getOverviewTicketsAction = async (name: string) => {
return 0; return 0;
}); });
return { tickets: sortedTickets, error }; return { tickets: sortedTickets };
} catch (e) {
console.error(e);
return { tickets, message: e.message ?? "" };
}
}; };

View file

@ -3,10 +3,15 @@ import { executeGraphQL } from "app/_lib/zammad";
import { searchQuery } from "@/app/_graphql/searchQuery"; import { searchQuery } from "@/app/_graphql/searchQuery";
export const searchAllAction = async (query: string, limit: number) => { export const searchAllAction = async (query: string, limit: number) => {
try {
const result = await executeGraphQL({ const result = await executeGraphQL({
query: searchQuery, query: searchQuery,
variables: { search: query, limit }, variables: { search: query, limit },
}); });
return result?.search; return result?.search;
} catch (e) {
console.error(e);
return [];
}
}; };

View file

@ -15,7 +15,7 @@ export const createTicketAction = async (
try { try {
const ticket = { const ticket = {
groupId: formData.get("groupId"), groupId: formData.get("groupId"),
customerId: `gid://zammad/User/3`, // { email: formData.get("customerId") }, customerId: formData.get("customerId"),
title: formData.get("title"), title: formData.get("title"),
article: { article: {
internal: true, internal: true,
@ -23,16 +23,13 @@ export const createTicketAction = async (
}, },
}; };
console.log({ ticket }); await executeGraphQL({
const result = await executeGraphQL({
query: createTicketMutation, query: createTicketMutation,
variables: { variables: {
input: ticket, input: ticket,
}, },
}); });
console.log({ result });
return { return {
...currentState, ...currentState,
values: ticket, values: ticket,
@ -61,7 +58,6 @@ export const createTicketArticleAction = async (
}, },
}); });
console.log({ result });
return { return {
result, result,
success: true, success: true,
@ -114,10 +110,8 @@ export const updateTicketAction = async (
tags: ticketInfo.tags, tags: ticketInfo.tags,
}, },
}); });
console.log({ tagsResult });
} }
console.log({ result });
return { return {
result, result,
success: true, success: true,
@ -132,24 +126,35 @@ export const updateTicketAction = async (
}; };
export const getTicketAction = async (id: string) => { export const getTicketAction = async (id: string) => {
try {
const ticketData = await executeGraphQL({ const ticketData = await executeGraphQL({
query: getTicketQuery, query: getTicketQuery,
variables: { ticketId: `gid://zammad/Ticket/${id}` }, variables: { ticketId: `gid://zammad/Ticket/${id}` },
}); });
console.log({ td: ticketData.ticket });
return ticketData?.ticket; return ticketData?.ticket;
} catch (e) {
console.error(e);
return {};
}
}; };
export const getTicketArticlesAction = async (id: string) => { export const getTicketArticlesAction = async (id: string) => {
try {
const ticketData = await executeGraphQL({ const ticketData = await executeGraphQL({
query: getTicketArticlesQuery, query: getTicketArticlesQuery,
variables: { ticketId: `gid://zammad/Ticket/${id}` }, variables: { ticketId: `gid://zammad/Ticket/${id}` },
}); });
return ticketData?.ticketArticles; return ticketData?.ticketArticles;
} catch (e) {
console.error(e);
return {};
}
}; };
export const getTicketStatesAction = async () => { export const getTicketStatesAction = async () => {
try {
const states = await executeREST({ const states = await executeREST({
path: "/api/v1/ticket_states", path: "/api/v1/ticket_states",
}); });
@ -161,17 +166,27 @@ export const getTicketStatesAction = async () => {
})) ?? []; })) ?? [];
return formattedStates; return formattedStates;
} catch (e) {
console.error(e);
return [];
}
}; };
export const getTagsAction = async () => { export const getTagsAction = async () => {
try {
const { tags } = await executeREST({ const { tags } = await executeREST({
path: "/api/v1/tags", path: "/api/v1/tags",
}); });
return tags; return tags;
} catch (e) {
console.error(e);
return [];
}
}; };
export const getTicketPrioritiesAction = async () => { export const getTicketPrioritiesAction = async () => {
try {
const priorities = await executeREST({ const priorities = await executeREST({
path: "/api/v1/ticket_priorities", path: "/api/v1/ticket_priorities",
}); });
@ -183,4 +198,8 @@ export const getTicketPrioritiesAction = async () => {
})) ?? []; })) ?? [];
return formattedPriorities; return formattedPriorities;
} catch (e) {
console.error(e);
return [];
}
}; };

View file

@ -3,10 +3,12 @@
import { executeREST } from "app/_lib/zammad"; import { executeREST } from "app/_lib/zammad";
export const getAgentsAction = async () => { export const getAgentsAction = async () => {
try {
const users = await executeREST({ const users = await executeREST({
path: "/api/v1/users", path: "/api/v1/users",
}); });
const agents = users?.filter((user: any) => user.role_ids.includes(2)) ?? []; const agents =
users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
const formattedAgents = agents const formattedAgents = agents
.map((agent: any) => ({ .map((agent: any) => ({
label: `${agent.firstname} ${agent.lastname}`, label: `${agent.firstname} ${agent.lastname}`,
@ -15,13 +17,17 @@ export const getAgentsAction = async () => {
.sort((a: any, b: any) => a.label.localeCompare(b.label)); .sort((a: any, b: any) => a.label.localeCompare(b.label));
return formattedAgents; return formattedAgents;
} catch (e) {
console.error(e);
return [];
}
}; };
export const getCustomersAction = async () => { export const getCustomersAction = async () => {
try {
const users = await executeREST({ const users = await executeREST({
path: "/api/v1/users", path: "/api/v1/users",
}); });
console.log({ users });
const customers = const customers =
users?.filter((user: any) => user.role_ids.includes(3)) ?? []; users?.filter((user: any) => user.role_ids.includes(3)) ?? [];
const formattedCustomers = customers const formattedCustomers = customers
@ -32,9 +38,14 @@ export const getCustomersAction = async () => {
.sort((a: any, b: any) => a.label.localeCompare(b.label)); .sort((a: any, b: any) => a.label.localeCompare(b.label));
return formattedCustomers; return formattedCustomers;
} catch (e) {
console.error(e);
return [];
}
}; };
export const getUsersAction = async () => { export const getUsersAction = async () => {
try {
const users = await executeREST({ const users = await executeREST({
path: "/api/v1/users", path: "/api/v1/users",
}); });
@ -47,4 +58,8 @@ export const getUsersAction = async () => {
.sort((a: any, b: any) => a.label.localeCompare(b.label)); .sort((a: any, b: any) => a.label.localeCompare(b.label));
return formattedUsers; return formattedUsers;
} catch (e) {
console.error(e);
return [];
}
}; };

View file

@ -1,22 +1,36 @@
"use client"; "use client";
import { FC, PropsWithChildren, useEffect } from "react"; import { FC, PropsWithChildren, useState, useEffect } from "react";
import { useRouter } from "next/navigation";
import { useSession } from "next-auth/react"; import { useSession } from "next-auth/react";
export const CSRFProvider: FC<PropsWithChildren> = ({ children }) => { export const CSRFProvider: FC<PropsWithChildren> = ({ children }) => {
const { data: session, status, update } = useSession(); const { data: session, status, update } = useSession();
const router = useRouter();
const [redirectCount, setRedirectCount] = useState(0);
useEffect(() => { useEffect(() => {
const interval = setInterval(async () => { const interval = setInterval(async () => {
console.log("Checking session status...");
console.log(status);
if (status === "authenticated") { if (status === "authenticated") {
const response = await fetch("/api/v1/users/me"); const response = await fetch("/api/v1/users/me");
console.log(response.ok);
console.log(!!router);
if (!response.ok && !!router) {
console.log("redirecting");
setRedirectCount(redirectCount + 1);
router.push("/setup");
} else {
setRedirectCount(0);
const token = response.headers.get("CSRF-Token"); const token = response.headers.get("CSRF-Token");
update({ csrfToken: token }); update({ csrfToken: token });
} }
}, 30000); }
}, 15000);
return () => clearInterval(interval); return () => clearInterval(interval);
}, [session, status, update]); }, [session, status, update, router]);
return children; return children;
}; };

View file

@ -1,4 +1,5 @@
import { getServerSession } from "app/_lib/authentication"; import { getServerSession } from "app/_lib/authentication";
import { redirect } from "next/navigation";
import { cookies } from "next/headers"; import { cookies } from "next/headers";
const getHeaders = async () => { const getHeaders = async () => {

View file

@ -10,12 +10,12 @@ const rewriteURL = (
const destinationURL = request.url.replace(originBaseURL, destinationBaseURL); const destinationURL = request.url.replace(originBaseURL, destinationBaseURL);
console.log(`Rewriting ${request.url} to ${destinationURL}`); console.log(`Rewriting ${request.url} to ${destinationURL}`);
const requestHeaders = new Headers(request.headers); const requestHeaders = new Headers(request.headers);
// console.log({ beforeHeaders: requestHeaders });
for (const [key, value] of Object.entries(headers)) { for (const [key, value] of Object.entries(headers)) {
requestHeaders.set(key, value as string); requestHeaders.set(key, value as string);
} }
requestHeaders.delete("connection"); requestHeaders.delete("connection");
// console.log({ afterHeaders: requestHeaders });
return NextResponse.rewrite(new URL(destinationURL), { return NextResponse.rewrite(new URL(destinationURL), {
request: { headers: requestHeaders }, request: { headers: requestHeaders },
}); });
@ -26,7 +26,15 @@ const checkRewrites = async (request: NextRequestWithAuth) => {
const zammadURL = process.env.ZAMMAD_URL ?? "http://zammad-nginx:8080"; const zammadURL = process.env.ZAMMAD_URL ?? "http://zammad-nginx:8080";
const opensearchDashboardsURL = const opensearchDashboardsURL =
process.env.OPENSEARCH_DASHBOARDS_URL ?? "http://macmini:5601"; process.env.OPENSEARCH_DASHBOARDS_URL ?? "http://macmini:5601";
const zammadPaths = ["/zammad", "/api/v1", "/auth/sso", "/assets", "/mobile"]; const zammadPaths = [
"/zammad",
"/api/v1",
"/auth/sso",
"/assets",
"/mobile",
"/graphql",
"/cable",
];
const { token } = request.nextauth; const { token } = request.nextauth;
const email = token?.email?.toLowerCase() ?? "unknown"; const email = token?.email?.toLowerCase() ?? "unknown";
let headers = { "x-forwarded-user": email }; let headers = { "x-forwarded-user": email };

View file

@ -24,8 +24,8 @@
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/material-nextjs": "^5.16.6", "@mui/material-nextjs": "^5.16.6",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"graphql": "^16.9.0", "graphql": "^16.9.0",
"graphql-request": "^7.1.0", "graphql-request": "^7.1.0",
@ -42,7 +42,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",

640
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,9 +7,10 @@
"build": "dotenv -- turbo build", "build": "dotenv -- turbo build",
"migrate": "dotenv -- npm run migrate --workspace=database", "migrate": "dotenv -- npm run migrate --workspace=database",
"lint": "dotenv turbo lint", "lint": "dotenv turbo lint",
"update-version": "find . -name 'package.json' -exec sed -i '' -E \"s/\\\"version\\\": \\\"[^\\\"]+\\\"/\\\"version\\\": \\\"$npm_config_newversion\\\"/\" {} +",
"upgrade:setup": "npm i -g npm-check-updates", "upgrade:setup": "npm i -g npm-check-updates",
"upgrade:check": "ncu && ncu -ws", "upgrade:check": "ncu && ncu -ws",
"upgrade:all": "ncu -u -x eslint -x kysely && ncu -ws -u -x eslint -x kysely && npm i", "upgrade": "ncu -u -x eslint -x kysely && ncu -ws -u -x eslint -x kysely && npm i",
"clean": "rm -f package-lock.json && rm -rf node_modules && rm -rf .turbo && rm -rf apps/*/node_modules && rm -rf apps/*/package-lock.json && rm -rf apps/*/.next && rm -rf packages/*/node_modules && rm -rf apps/*/.next && rm -rf packages/*/.turbo && rm -rf packages/*/build && rm -rf docker/zammad/addons/*", "clean": "rm -f package-lock.json && rm -rf node_modules && rm -rf .turbo && rm -rf apps/*/node_modules && rm -rf apps/*/package-lock.json && rm -rf apps/*/.next && rm -rf packages/*/node_modules && rm -rf apps/*/.next && rm -rf packages/*/.turbo && rm -rf packages/*/build && rm -rf docker/zammad/addons/*",
"docker:all:up": "node docker/scripts/docker.js all up", "docker:all:up": "node docker/scripts/docker.js all up",
"docker:all:down": "node docker/scripts/docker.js all down", "docker:all:down": "node docker/scripts/docker.js all down",

View file

@ -20,7 +20,7 @@
"@babel/preset-typescript": "7.24.7", "@babel/preset-typescript": "7.24.7",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"@link-stack/typescript-config": "*", "@link-stack/typescript-config": "*",
"tsx": "^4.16.5", "tsx": "^4.17.0",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
} }

View file

@ -81,6 +81,12 @@ export class Service {
req: NextRequest, req: NextRequest,
{ params: { service, token } }: ServiceParams, { params: { service, token } }: ServiceParams,
): Promise<NextResponse> { ): 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 json = await req.json();
const worker = await getWorkerUtils(); const worker = await getWorkerUtils();
await worker.addJob(`${service}/send-${service}-message`, { await worker.addJob(`${service}/send-${service}-message`, {
@ -88,7 +94,17 @@ export class Service {
...json, ...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( async receiveMessage(

View file

@ -13,8 +13,8 @@
"@link-stack/signal-api": "*", "@link-stack/signal-api": "*",
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"kysely": "0.26.1", "kysely": "0.26.1",
"material-ui-popup-state": "^5.1.2", "material-ui-popup-state": "^5.1.2",
@ -32,7 +32,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",

View file

@ -10,14 +10,14 @@
}, },
"dependencies": { "dependencies": {
"@rushstack/eslint-patch": "^1.10.4", "@rushstack/eslint-patch": "^1.10.4",
"@typescript-eslint/eslint-plugin": "^8.0.1", "@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.0.1", "@typescript-eslint/parser": "^8.1.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-config-xo-space": "^0.35.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-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1", "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-promise": "^7.1.0",
"eslint-plugin-unicorn": "55.0.0", "eslint-plugin-unicorn": "55.0.0",
"@babel/eslint-parser": "7.25.1" "@babel/eslint-parser": "7.25.1"

View file

@ -11,8 +11,8 @@
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"@link-stack/opensearch-common": "*", "@link-stack/opensearch-common": "*",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"material-ui-popup-state": "^5.1.2", "material-ui-popup-state": "^5.1.2",
@ -29,7 +29,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",

View file

@ -10,7 +10,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"@types/uuid": "^10.0.0", "@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",

View file

@ -9,14 +9,14 @@
"dependencies": { "dependencies": {
"@mui/icons-material": "^5", "@mui/icons-material": "^5",
"@mui/material": "^5", "@mui/material": "^5",
"@mui/x-data-grid-pro": "^7.12.0", "@mui/x-data-grid-pro": "^7.12.1",
"@mui/x-date-pickers-pro": "^7.12.0", "@mui/x-date-pickers-pro": "^7.12.1",
"next": "14.2.5", "next": "14.2.5",
"react": "18.3.1", "react": "18.3.1",
"react-dom": "18.3.1" "react-dom": "18.3.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.1.0", "@types/node": "^22.2.0",
"@types/react": "18.3.3", "@types/react": "18.3.3",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }

View file

@ -61,16 +61,16 @@ class CommunicateCdrSignalJob < ApplicationJob
return if has_error return if has_error
article.to = result['result']['recipient'] article.to = result['result']['to']
article.from = result['result']['source'] 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']) timestamp: result['result']['timestamp'])
article.preferences['cdr_signal'] = { article.preferences['cdr_signal'] = {
timestamp: result['result']['timestamp'], timestamp: result['result']['timestamp'],
message_id: message_id, message_id: message_id,
from: result['result']['source'], from: result['result']['from'],
to: result['result']['recipient'] to: result['result']['to']
} }
# set delivery status # set delivery status

View file

@ -61,16 +61,16 @@ class CommunicateCdrWhatsappJob < ApplicationJob
return if has_error return if has_error
article.to = result['result']['recipient'] article.to = result['result']['to']
article.from = result['result']['source'] 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']) timestamp: result['result']['timestamp'])
article.preferences['cdr_whatsapp'] = { article.preferences['cdr_whatsapp'] = {
timestamp: result['result']['timestamp'], timestamp: result['result']['timestamp'],
message_id: message_id, message_id: message_id,
from: result['result']['source'], from: result['result']['from'],
to: result['result']['recipient'] to: result['result']['to']
} }
# set delivery status # set delivery status

View file

@ -118,7 +118,7 @@ class CdrSignal
end end
def self.message_id(message_raw) 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 end
# #

View file

@ -118,7 +118,7 @@ class CdrWhatsapp
end end
def self.message_id(message_raw) 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 end
# #