mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
chore: add the dropdown service to the api repo
This commit is contained in:
@@ -12,6 +12,15 @@ import { bookingsService } from "./bookings.service";
|
|||||||
import { consignmentsService } from "./consignments.service";
|
import { consignmentsService } from "./consignments.service";
|
||||||
import { trackingService } from "./tracking.service";
|
import { trackingService } from "./tracking.service";
|
||||||
import { fileUploadSettingsService } from "./fileUploadSettings.service";
|
import { fileUploadSettingsService } from "./fileUploadSettings.service";
|
||||||
|
import { dropdownSettingsService } from "./dropdownSettings.service";
|
||||||
|
import {
|
||||||
|
CreateDropdownOptionDto,
|
||||||
|
CreateDropdownSettingDto,
|
||||||
|
DropdownOption,
|
||||||
|
DropdownSetting,
|
||||||
|
UpdateDropdownOptionDto,
|
||||||
|
UpdateDropdownSettingDto,
|
||||||
|
} from "@/types/dropdownSettings";
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// API definition
|
// API definition
|
||||||
@@ -135,4 +144,69 @@ export const api = {
|
|||||||
({ fieldId }) => fileUploadSettingsService.removeField(fieldId),
|
({ fieldId }) => fileUploadSettingsService.removeField(fieldId),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dropdownSettings: {
|
||||||
|
list: endpoint<void, DropdownSetting[]>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"list",
|
||||||
|
dropdownSettingsService.list,
|
||||||
|
),
|
||||||
|
|
||||||
|
getById: endpoint<{ id: string }, DropdownSetting>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"getById",
|
||||||
|
({ id }) => dropdownSettingsService.getById(id),
|
||||||
|
),
|
||||||
|
|
||||||
|
getByCode: endpoint<{ code: string }, DropdownSetting>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"getByCode",
|
||||||
|
({ code }) => dropdownSettingsService.getByCode(code),
|
||||||
|
),
|
||||||
|
|
||||||
|
create: endpoint<CreateDropdownSettingDto, DropdownSetting>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"create",
|
||||||
|
(payload) => dropdownSettingsService.create(payload),
|
||||||
|
),
|
||||||
|
|
||||||
|
update: endpoint<
|
||||||
|
{ id: string; dto: UpdateDropdownSettingDto },
|
||||||
|
DropdownSetting
|
||||||
|
>("dropdown-settings", "update", ({ id, dto }) =>
|
||||||
|
dropdownSettingsService.update(id, dto),
|
||||||
|
),
|
||||||
|
|
||||||
|
remove: endpoint<{ id: string }, void>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"remove",
|
||||||
|
({ id }) => dropdownSettingsService.remove(id),
|
||||||
|
),
|
||||||
|
replaceOptions: endpoint<
|
||||||
|
{ id: string; options: CreateDropdownOptionDto[] },
|
||||||
|
DropdownOption[]
|
||||||
|
>("dropdown-settings", "replaceOptions", ({ id, options }) =>
|
||||||
|
dropdownSettingsService.replaceOptions(id, options),
|
||||||
|
),
|
||||||
|
|
||||||
|
addOption: endpoint<
|
||||||
|
{ id: string; dto: CreateDropdownOptionDto },
|
||||||
|
DropdownOption
|
||||||
|
>("dropdown-settings", "addOption", ({ id, dto }) =>
|
||||||
|
dropdownSettingsService.addOption(id, dto),
|
||||||
|
),
|
||||||
|
|
||||||
|
updateOption: endpoint<
|
||||||
|
{ optionId: string; dto: UpdateDropdownOptionDto },
|
||||||
|
DropdownOption
|
||||||
|
>("dropdown-settings", "updateOption", ({ optionId, dto }) =>
|
||||||
|
dropdownSettingsService.updateOption(optionId, dto),
|
||||||
|
),
|
||||||
|
|
||||||
|
removeOption: endpoint<{ optionId: string }, void>(
|
||||||
|
"dropdown-settings",
|
||||||
|
"removeOption",
|
||||||
|
({ optionId }) => dropdownSettingsService.removeOption(optionId),
|
||||||
|
),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user