updated last web service

This commit is contained in:
2025-06-02 21:11:15 +03:00
parent df3f59bd8e
commit 0cd0eb0f22
106 changed files with 1061 additions and 50 deletions

View File

@@ -0,0 +1,29 @@
"use server";
import { fetchData } from "@/fetchers/fecther";
import { urlTesterList } from "@/fetchers/index";
export const fetchTest = async ({
page,
size,
orderField,
orderType,
query,
}: {
page?: number;
size?: number;
orderField?: string[];
orderType?: string[];
query?: any;
}) => {
try {
const response = await fetchData(urlTesterList, { method: "POST", cache: false, payload: { page, size, orderField, orderType, query } });
return response.data;
} catch (error) {
console.error(error);
return {
completed: false,
data: null,
message: "No data is found",
};
}
};

View File

@@ -1,36 +1,36 @@
import { formatServiceUrl } from "./utils";
const baseUrlAuth = formatServiceUrl(
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "localhost:8001"
);
const baseUrlRestriction = formatServiceUrl(
process.env.NEXT_PUBLIC_RESTRICTION_SERVICE_URL || "restriction_service:8002"
process.env.NEXT_PUBLIC_RESTRICTION_SERVICE_URL || "localhost:8002"
);
const baseUrlApplication = formatServiceUrl(
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8003"
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "localhost:8003"
);
const baseUrlAccount = formatServiceUrl(
process.env.NEXT_PUBLIC_ACCOUNT_SERVICE_URL || "account_service:8004"
process.env.NEXT_PUBLIC_ACCOUNT_SERVICE_URL || "localhost:8004"
);
const baseUrlBuilding = formatServiceUrl(
process.env.NEXT_PUBLIC_BUILDING_SERVICE_URL || "building_service:8006"
process.env.NEXT_PUBLIC_BUILDING_SERVICE_URL || "localhost:8006"
);
const baseUrlPeople = formatServiceUrl(
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "validation_service:8009"
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "localhost:8009"
);
const baseUrlTester = formatServiceUrl(
process.env.NEXT_PUBLIC_TESTER_SERVICE_URL || "localhost:8005"
);
const urlCheckToken = `${baseUrlAuth}/authentication/token/check`;
const urlPageValid = `${baseUrlRestriction}/restrictions/page/valid`;
const urlSiteUrls = `${baseUrlRestriction}/restrictions/sites/list`;
const urlTesterList = `${baseUrlTester}/tester/list`;
export {
baseUrlAuth,
baseUrlPeople,
baseUrlApplication,
baseUrlAccount,
baseUrlBuilding,
baseUrlRestriction,
urlCheckToken,
urlPageValid,
urlSiteUrls,
// For test use only
urlTesterList,
};

View File

@@ -2,7 +2,7 @@ import { cookies } from "next/headers";
import { fetchDataWithToken } from "@/fetchers/fecther";
import { urlCheckToken, urlPageValid, urlSiteUrls } from "@/fetchers/index";
import { nextCrypto } from "@/fetchers/base";
import { AuthError } from "@/validations/mutual/context/validations";
import { AuthError } from "@/fetchers/types/context";
import { fetchResponseStatus } from "@/fetchers/utils";
async function checkAccessTokenIsValid() {