Skip to content

Commit

Permalink
feat(management): add backend functions and translation (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusualhashash authored Jan 7, 2025
2 parents 6f2699c + 2d737c0 commit 87cf8df
Show file tree
Hide file tree
Showing 35 changed files with 1,651 additions and 4,448 deletions.
99 changes: 95 additions & 4 deletions apps/web/src/actions/core/AdministrationService/actions.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
"use server";
import type { GetApiPermissionManagementPermissionsData } from "@ayasofyazilim/saas/AdministrationService";
import type {
GetApiAuditLoggingAuditLogsData,
GetApiLanguageManagementLanguagesData,
GetApiLanguageManagementLanguageTextsData,
GetApiPermissionManagementPermissionsData,
GetApiTextTemplateManagementTemplateDefinitionsData,
} from "@ayasofyazilim/saas/AdministrationService";
import {
getAdministrationServiceClient,
structuredError,
structuredResponse,
} from "src/lib";
import { getApiRequests } from "../../api-requests";

export async function getPermissionsApi(
data: GetApiPermissionManagementPermissionsData,
) {
try {
const requests = await getApiRequests();
const dataResponse = await requests.permissions.getPermissions(data);
const client = await getAdministrationServiceClient();
const dataResponse =
await client.permissions.getApiPermissionManagementPermissions(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
Expand All @@ -29,3 +35,88 @@ export async function getCountrySettingsApi() {
return structuredError(error);
}
}

export async function getTextTemplateApi(
data: GetApiTextTemplateManagementTemplateDefinitionsData,
) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.textTemplateDefinitions.getApiTextTemplateManagementTemplateDefinitions(
data,
);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getAuditLogsApi(data: GetApiAuditLoggingAuditLogsData) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.auditLogs.getApiAuditLoggingAuditLogs(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getLanguagesApi(
data: GetApiLanguageManagementLanguagesData,
) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.getApiLanguageManagementLanguages(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getLanguageDetailsByIdApi(id: string) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.getApiLanguageManagementLanguagesById({ id });
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getLanguagesResourcesApi() {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.getApiLanguageManagementLanguagesResources();
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getLanguagesCultureListApi() {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.getApiLanguageManagementLanguagesCultureList();
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function getLanguageTextsApi(
data: GetApiLanguageManagementLanguageTextsData,
) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languageTexts.getApiLanguageManagementLanguageTexts(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}
20 changes: 20 additions & 0 deletions apps/web/src/actions/core/AdministrationService/delete-actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use server";

import {
getAdministrationServiceClient,
structuredError,
structuredResponse,
} from "src/lib";

export async function deleteLanguageByIdApi(id: string) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.deleteApiLanguageManagementLanguagesById({
id,
});
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}
21 changes: 21 additions & 0 deletions apps/web/src/actions/core/AdministrationService/post-actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use server";

import type { PostApiLanguageManagementLanguagesData } from "@ayasofyazilim/saas/AdministrationService";
import {
getAdministrationServiceClient,
structuredError,
structuredResponse,
} from "src/lib";

export async function postLanguageApi(
data: PostApiLanguageManagementLanguagesData,
) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.postApiLanguageManagementLanguages(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}
33 changes: 30 additions & 3 deletions apps/web/src/actions/core/AdministrationService/put-actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use server";
import type {
PutApiLanguageManagementLanguagesByIdData,
PutApiPermissionManagementPermissionsData,
UniRefund_AdministrationService_CountrySettings_SetCountrySettingsByListDto,
} from "@ayasofyazilim/saas/AdministrationService";
Expand All @@ -8,14 +9,14 @@ import {
structuredError,
structuredResponse,
} from "src/lib";
import { getApiRequests } from "../../api-requests";

export async function putPermissionsApi(
data: PutApiPermissionManagementPermissionsData,
) {
try {
const requests = await getApiRequests();
const dataResponse = await requests.permissions.putPermissions(data);
const client = await getAdministrationServiceClient();
const dataResponse =
await client.permissions.putApiPermissionManagementPermissions(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
Expand All @@ -37,3 +38,29 @@ export async function putCountrySettingsApi(
return structuredError(error);
}
}

export async function putLanguageApi(
data: PutApiLanguageManagementLanguagesByIdData,
) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.putApiLanguageManagementLanguagesById(data);
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}

export async function putLanguagesByIdSetAsDefaultApi(id: string) {
try {
const client = await getAdministrationServiceClient();
const dataResponse =
await client.languages.putApiLanguageManagementLanguagesByIdSetAsDefault({
id,
});
return structuredResponse(dataResponse);
} catch (error) {
return structuredError(error);
}
}
Loading

0 comments on commit 87cf8df

Please sign in to comment.