@open-mercato/core 0.4.6-develop-9ff1d4a9a2 → 0.4.6-develop-219dae16c5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/currencies/backend/exchange-rates/[id]/page.js +17 -154
- package/dist/modules/currencies/backend/exchange-rates/[id]/page.js.map +3 -3
- package/dist/modules/currencies/backend/exchange-rates/create/page.js +14 -152
- package/dist/modules/currencies/backend/exchange-rates/create/page.js.map +2 -2
- package/dist/modules/currencies/lib/exchangeRateFormConfig.js +167 -0
- package/dist/modules/currencies/lib/exchangeRateFormConfig.js.map +7 -0
- package/dist/modules/customers/api/dashboard/widgets/utils.js +1 -34
- package/dist/modules/customers/api/dashboard/widgets/utils.js.map +2 -2
- package/dist/modules/customers/commands/activities.js +3 -8
- package/dist/modules/customers/commands/activities.js.map +2 -2
- package/dist/modules/customers/commands/comments.js +2 -8
- package/dist/modules/customers/commands/comments.js.map +2 -2
- package/dist/modules/dashboards/lib/widgetScope.js +38 -0
- package/dist/modules/dashboards/lib/widgetScope.js.map +7 -0
- package/dist/modules/entities/lib/makeActivityRoute.js +265 -0
- package/dist/modules/entities/lib/makeActivityRoute.js.map +7 -0
- package/dist/modules/resources/api/activities.js +24 -232
- package/dist/modules/resources/api/activities.js.map +2 -2
- package/dist/modules/resources/commands/activities.js +3 -8
- package/dist/modules/resources/commands/activities.js.map +2 -2
- package/dist/modules/resources/commands/comments.js +2 -8
- package/dist/modules/resources/commands/comments.js.map +2 -2
- package/dist/modules/sales/api/dashboard/widgets/new-orders/route.js +27 -182
- package/dist/modules/sales/api/dashboard/widgets/new-orders/route.js.map +2 -2
- package/dist/modules/sales/api/dashboard/widgets/new-quotes/route.js +28 -183
- package/dist/modules/sales/api/dashboard/widgets/new-quotes/route.js.map +2 -2
- package/dist/modules/sales/api/order-line-statuses/route.js +15 -194
- package/dist/modules/sales/api/order-line-statuses/route.js.map +2 -2
- package/dist/modules/sales/api/order-lines/route.js +15 -281
- package/dist/modules/sales/api/order-lines/route.js.map +2 -2
- package/dist/modules/sales/api/order-statuses/route.js +15 -194
- package/dist/modules/sales/api/order-statuses/route.js.map +2 -2
- package/dist/modules/sales/api/payment-statuses/route.js +15 -194
- package/dist/modules/sales/api/payment-statuses/route.js.map +2 -2
- package/dist/modules/sales/api/quote-lines/route.js +15 -279
- package/dist/modules/sales/api/quote-lines/route.js.map +2 -2
- package/dist/modules/sales/api/shipment-statuses/route.js +15 -194
- package/dist/modules/sales/api/shipment-statuses/route.js.map +2 -2
- package/dist/modules/sales/components/PaymentMethodsSettings.js +3 -84
- package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
- package/dist/modules/sales/components/ProviderFieldInput.js +86 -0
- package/dist/modules/sales/components/ProviderFieldInput.js.map +7 -0
- package/dist/modules/sales/components/ShippingMethodsSettings.js +3 -82
- package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
- package/dist/modules/sales/lib/makeSalesLineRoute.js +308 -0
- package/dist/modules/sales/lib/makeSalesLineRoute.js.map +7 -0
- package/dist/modules/sales/lib/makeStatusDictionaryRoute.js +206 -0
- package/dist/modules/sales/lib/makeStatusDictionaryRoute.js.map +7 -0
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js +178 -0
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js.map +7 -0
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js +1 -39
- package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js +1 -39
- package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/shared.js +46 -0
- package/dist/modules/sales/widgets/dashboard/shared.js.map +7 -0
- package/dist/modules/staff/api/activities.js +24 -232
- package/dist/modules/staff/api/activities.js.map +2 -2
- package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js +14 -34
- package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js +15 -34
- package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js.map +2 -2
- package/dist/modules/staff/commands/activities.js +3 -8
- package/dist/modules/staff/commands/activities.js.map +2 -2
- package/dist/modules/staff/commands/comments.js +2 -8
- package/dist/modules/staff/commands/comments.js.map +2 -2
- package/dist/modules/staff/lib/leaveRequestHelpers.js +41 -0
- package/dist/modules/staff/lib/leaveRequestHelpers.js.map +7 -0
- package/package.json +2 -2
- package/src/modules/currencies/backend/exchange-rates/[id]/page.tsx +20 -180
- package/src/modules/currencies/backend/exchange-rates/create/page.tsx +16 -175
- package/src/modules/currencies/lib/exchangeRateFormConfig.ts +200 -0
- package/src/modules/customers/api/dashboard/widgets/utils.ts +1 -53
- package/src/modules/customers/commands/activities.ts +2 -8
- package/src/modules/customers/commands/comments.ts +2 -8
- package/src/modules/dashboards/i18n/de.json +3 -0
- package/src/modules/dashboards/i18n/en.json +3 -0
- package/src/modules/dashboards/i18n/es.json +3 -0
- package/src/modules/dashboards/i18n/pl.json +3 -0
- package/src/modules/dashboards/lib/widgetScope.ts +53 -0
- package/src/modules/entities/lib/makeActivityRoute.ts +327 -0
- package/src/modules/resources/api/activities.ts +25 -269
- package/src/modules/resources/commands/activities.ts +2 -7
- package/src/modules/resources/commands/comments.ts +2 -8
- package/src/modules/sales/api/dashboard/widgets/new-orders/route.ts +29 -244
- package/src/modules/sales/api/dashboard/widgets/new-quotes/route.ts +30 -245
- package/src/modules/sales/api/order-line-statuses/route.ts +16 -209
- package/src/modules/sales/api/order-lines/route.ts +16 -300
- package/src/modules/sales/api/order-statuses/route.ts +16 -209
- package/src/modules/sales/api/payment-statuses/route.ts +16 -209
- package/src/modules/sales/api/quote-lines/route.ts +16 -298
- package/src/modules/sales/api/shipment-statuses/route.ts +16 -209
- package/src/modules/sales/components/PaymentMethodsSettings.tsx +3 -88
- package/src/modules/sales/components/ProviderFieldInput.tsx +85 -0
- package/src/modules/sales/components/ShippingMethodsSettings.tsx +3 -86
- package/src/modules/sales/lib/makeSalesLineRoute.ts +345 -0
- package/src/modules/sales/lib/makeStatusDictionaryRoute.ts +229 -0
- package/src/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.ts +247 -0
- package/src/modules/sales/widgets/dashboard/new-orders/widget.client.tsx +7 -50
- package/src/modules/sales/widgets/dashboard/new-quotes/widget.client.tsx +7 -49
- package/src/modules/sales/widgets/dashboard/shared.ts +44 -0
- package/src/modules/staff/api/activities.ts +25 -269
- package/src/modules/staff/backend/staff/leave-requests/[id]/page.tsx +15 -69
- package/src/modules/staff/backend/staff/my-leave-requests/[id]/page.tsx +16 -65
- package/src/modules/staff/commands/activities.ts +2 -7
- package/src/modules/staff/commands/comments.ts +2 -8
- package/src/modules/staff/lib/leaveRequestHelpers.ts +78 -0
|
@@ -1,201 +1,22 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { makeCrudRoute } from "@open-mercato/shared/lib/crud/factory";
|
|
3
|
-
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
4
|
-
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
5
|
-
import { Dictionary, DictionaryEntry } from "@open-mercato/core/modules/dictionaries/data/entities";
|
|
6
1
|
import { E } from "../../../../generated/entities.ids.generated.js";
|
|
7
2
|
import * as F from "../../../../generated/entities/dictionary_entry/index.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const rawBodySchema = z.object({}).passthrough();
|
|
18
|
-
const listSchema = z.object({
|
|
19
|
-
page: z.coerce.number().min(1).default(1),
|
|
20
|
-
pageSize: z.coerce.number().min(1).max(100).default(50),
|
|
21
|
-
search: z.string().optional(),
|
|
22
|
-
sortField: z.string().optional(),
|
|
23
|
-
sortDir: z.enum(["asc", "desc"]).optional()
|
|
24
|
-
}).passthrough();
|
|
25
|
-
const kind = "payment-status";
|
|
26
|
-
const definition = getSalesDictionaryDefinition(kind);
|
|
27
|
-
const metadata = {
|
|
28
|
-
GET: { requireAuth: true, requireFeatures: ["sales.settings.manage"] },
|
|
29
|
-
POST: { requireAuth: true, requireFeatures: ["sales.settings.manage"] },
|
|
30
|
-
PUT: { requireAuth: true, requireFeatures: ["sales.settings.manage"] },
|
|
31
|
-
DELETE: { requireAuth: true, requireFeatures: ["sales.settings.manage"] }
|
|
32
|
-
};
|
|
33
|
-
const dictionaryItemSchema = z.object({
|
|
34
|
-
id: z.string().uuid(),
|
|
35
|
-
value: z.string(),
|
|
36
|
-
label: z.string().nullable(),
|
|
37
|
-
color: z.string().nullable(),
|
|
38
|
-
icon: z.string().nullable(),
|
|
39
|
-
organizationId: z.string().uuid().nullable(),
|
|
40
|
-
tenantId: z.string().uuid().nullable(),
|
|
41
|
-
createdAt: z.string(),
|
|
42
|
-
updatedAt: z.string()
|
|
43
|
-
});
|
|
44
|
-
const dictionaryListResponseSchema = createPagedListResponseSchema(dictionaryItemSchema);
|
|
45
|
-
const normalizeId = (value) => {
|
|
46
|
-
if (typeof value !== "string") return null;
|
|
47
|
-
const trimmed = value.trim();
|
|
48
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
49
|
-
};
|
|
50
|
-
async function resolveDictionaryContext(ctx) {
|
|
51
|
-
if (!ctx.auth || !ctx.auth.tenantId) {
|
|
52
|
-
throw new CrudHttpError(401, { error: "Tenant context is required." });
|
|
53
|
-
}
|
|
54
|
-
const em = ctx.container.resolve("em");
|
|
55
|
-
const tenantId = ctx.auth.tenantId;
|
|
56
|
-
const candidateOrgIds = /* @__PURE__ */ new Set();
|
|
57
|
-
const pushCandidate = (value) => {
|
|
58
|
-
const normalized = normalizeId(value);
|
|
59
|
-
if (normalized) candidateOrgIds.add(normalized);
|
|
60
|
-
};
|
|
61
|
-
pushCandidate(ctx.selectedOrganizationId);
|
|
62
|
-
pushCandidate(ctx.auth.orgId ?? null);
|
|
63
|
-
const scope = ctx.organizationScope;
|
|
64
|
-
if (scope) {
|
|
65
|
-
if (Array.isArray(scope.filterIds)) {
|
|
66
|
-
for (const id of scope.filterIds) pushCandidate(id);
|
|
67
|
-
}
|
|
68
|
-
if (Array.isArray(scope.allowedIds)) {
|
|
69
|
-
for (const id of scope.allowedIds) pushCandidate(id);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
for (const orgId of candidateOrgIds) {
|
|
73
|
-
const dictionary = await ensureSalesDictionary({
|
|
74
|
-
em,
|
|
75
|
-
tenantId,
|
|
76
|
-
organizationId: orgId,
|
|
77
|
-
kind
|
|
78
|
-
});
|
|
79
|
-
if (dictionary) {
|
|
80
|
-
return { dictionaryId: dictionary.id, organizationId: orgId };
|
|
81
|
-
}
|
|
3
|
+
import { makeStatusDictionaryRoute } from "../../lib/makeStatusDictionaryRoute.js";
|
|
4
|
+
const route = makeStatusDictionaryRoute({
|
|
5
|
+
kind: "payment-status",
|
|
6
|
+
entityId: E.dictionaries.dictionary_entry,
|
|
7
|
+
fieldConstants: F,
|
|
8
|
+
openApi: {
|
|
9
|
+
resourceName: "Payment status",
|
|
10
|
+
pluralName: "Payment statuses",
|
|
11
|
+
description: "Manage the lifecycle states available for payments."
|
|
82
12
|
}
|
|
83
|
-
const fallback = await em.findOne(
|
|
84
|
-
Dictionary,
|
|
85
|
-
{
|
|
86
|
-
tenantId,
|
|
87
|
-
key: definition.key,
|
|
88
|
-
deletedAt: null
|
|
89
|
-
},
|
|
90
|
-
{ orderBy: { createdAt: "asc" } }
|
|
91
|
-
);
|
|
92
|
-
if (fallback) {
|
|
93
|
-
return { dictionaryId: fallback.id, organizationId: fallback.organizationId };
|
|
94
|
-
}
|
|
95
|
-
throw new CrudHttpError(400, { error: "Organization context is required." });
|
|
96
|
-
}
|
|
97
|
-
const crud = makeCrudRoute({
|
|
98
|
-
metadata,
|
|
99
|
-
orm: {
|
|
100
|
-
entity: DictionaryEntry,
|
|
101
|
-
idField: "id",
|
|
102
|
-
orgField: "organizationId",
|
|
103
|
-
tenantField: "tenantId",
|
|
104
|
-
softDeleteField: null
|
|
105
|
-
},
|
|
106
|
-
list: {
|
|
107
|
-
schema: listSchema,
|
|
108
|
-
entityId: E.dictionaries.dictionary_entry,
|
|
109
|
-
fields: [
|
|
110
|
-
F.id,
|
|
111
|
-
F.value,
|
|
112
|
-
F.label,
|
|
113
|
-
F.color,
|
|
114
|
-
F.icon,
|
|
115
|
-
F.organization_id,
|
|
116
|
-
F.tenant_id,
|
|
117
|
-
F.created_at,
|
|
118
|
-
F.updated_at
|
|
119
|
-
],
|
|
120
|
-
sortFieldMap: {
|
|
121
|
-
id: F.id,
|
|
122
|
-
value: F.value,
|
|
123
|
-
label: F.label,
|
|
124
|
-
createdAt: F.created_at,
|
|
125
|
-
updatedAt: F.updated_at
|
|
126
|
-
},
|
|
127
|
-
buildFilters: async (query, ctx) => {
|
|
128
|
-
const { dictionaryId } = await resolveDictionaryContext(ctx);
|
|
129
|
-
const filters = {
|
|
130
|
-
dictionary_id: dictionaryId
|
|
131
|
-
};
|
|
132
|
-
if (query.search && query.search.trim().length > 0) {
|
|
133
|
-
const term = `%${escapeLikePattern(query.search.trim())}%`;
|
|
134
|
-
filters.$or = [
|
|
135
|
-
{ [F.value]: { $ilike: term } },
|
|
136
|
-
{ [F.label]: { $ilike: term } }
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
return filters;
|
|
140
|
-
},
|
|
141
|
-
transformItem: (item) => ({
|
|
142
|
-
id: item.id,
|
|
143
|
-
value: item.value,
|
|
144
|
-
label: item.label,
|
|
145
|
-
color: item.color ?? null,
|
|
146
|
-
icon: item.icon ?? null,
|
|
147
|
-
organizationId: item.organization_id ?? null,
|
|
148
|
-
tenantId: item.tenant_id ?? null,
|
|
149
|
-
createdAt: item.created_at,
|
|
150
|
-
updatedAt: item.updated_at
|
|
151
|
-
})
|
|
152
|
-
},
|
|
153
|
-
actions: {
|
|
154
|
-
create: {
|
|
155
|
-
commandId: `${definition.commandPrefix}.create`,
|
|
156
|
-
schema: rawBodySchema,
|
|
157
|
-
mapInput: async ({ raw, ctx }) => {
|
|
158
|
-
const { translate } = await resolveTranslations();
|
|
159
|
-
return parseScopedCommandInput(statusDictionaryCreateSchema, raw ?? {}, ctx, translate);
|
|
160
|
-
},
|
|
161
|
-
response: ({ result }) => ({ id: result?.entryId ?? null }),
|
|
162
|
-
status: 201
|
|
163
|
-
},
|
|
164
|
-
update: {
|
|
165
|
-
commandId: `${definition.commandPrefix}.update`,
|
|
166
|
-
schema: rawBodySchema,
|
|
167
|
-
mapInput: async ({ raw, ctx }) => {
|
|
168
|
-
const { translate } = await resolveTranslations();
|
|
169
|
-
return parseScopedCommandInput(statusDictionaryUpdateSchema, raw ?? {}, ctx, translate);
|
|
170
|
-
},
|
|
171
|
-
response: () => ({ ok: true })
|
|
172
|
-
},
|
|
173
|
-
delete: {
|
|
174
|
-
commandId: `${definition.commandPrefix}.delete`,
|
|
175
|
-
schema: rawBodySchema,
|
|
176
|
-
mapInput: async ({ parsed, ctx }) => {
|
|
177
|
-
const { translate } = await resolveTranslations();
|
|
178
|
-
const id = resolveCrudRecordId(parsed, ctx, translate);
|
|
179
|
-
return { id };
|
|
180
|
-
},
|
|
181
|
-
response: () => ({ ok: true })
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
const openApi = createSalesCrudOpenApi({
|
|
186
|
-
resourceName: "Payment status",
|
|
187
|
-
pluralName: "Payment statuses",
|
|
188
|
-
description: "Manage the lifecycle states available for payments.",
|
|
189
|
-
querySchema: listSchema,
|
|
190
|
-
listResponseSchema: dictionaryListResponseSchema,
|
|
191
|
-
create: { schema: statusDictionaryCreateSchema },
|
|
192
|
-
update: { schema: statusDictionaryUpdateSchema },
|
|
193
|
-
del: { schema: defaultDeleteRequestSchema }
|
|
194
13
|
});
|
|
195
|
-
const
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
const
|
|
14
|
+
const metadata = route.metadata;
|
|
15
|
+
const openApi = route.openApi;
|
|
16
|
+
const GET = route.GET;
|
|
17
|
+
const POST = route.POST;
|
|
18
|
+
const PUT = route.PUT;
|
|
19
|
+
const DELETE = route.DELETE;
|
|
199
20
|
export {
|
|
200
21
|
DELETE,
|
|
201
22
|
GET,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/sales/api/payment-statuses/route.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;AAClB,
|
|
4
|
+
"sourcesContent": ["import { E } from '#generated/entities.ids.generated'\nimport * as F from '#generated/entities/dictionary_entry'\nimport { makeStatusDictionaryRoute } from '../../lib/makeStatusDictionaryRoute'\n\nconst route = makeStatusDictionaryRoute({\n kind: 'payment-status',\n entityId: E.dictionaries.dictionary_entry,\n fieldConstants: F,\n openApi: {\n resourceName: 'Payment status',\n pluralName: 'Payment statuses',\n description: 'Manage the lifecycle states available for payments.',\n },\n})\n\nexport const metadata = route.metadata\nexport const openApi = route.openApi\nexport const GET = route.GET\nexport const POST = route.POST\nexport const PUT = route.PUT\nexport const DELETE = route.DELETE\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAClB,YAAY,OAAO;AACnB,SAAS,iCAAiC;AAE1C,MAAM,QAAQ,0BAA0B;AAAA,EACtC,MAAM;AAAA,EACN,UAAU,EAAE,aAAa;AAAA,EACzB,gBAAgB;AAAA,EAChB,SAAS;AAAA,IACP,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,aAAa;AAAA,EACf;AACF,CAAC;AAEM,MAAM,WAAW,MAAM;AACvB,MAAM,UAAU,MAAM;AACtB,MAAM,MAAM,MAAM;AAClB,MAAM,OAAO,MAAM;AACnB,MAAM,MAAM,MAAM;AAClB,MAAM,SAAS,MAAM;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,288 +1,24 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { makeCrudRoute } from "@open-mercato/shared/lib/crud/factory";
|
|
3
|
-
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
4
|
-
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
5
|
-
import {
|
|
6
|
-
buildCustomFieldFiltersFromQuery,
|
|
7
|
-
extractAllCustomFieldEntries
|
|
8
|
-
} from "@open-mercato/shared/lib/crud/custom-fields";
|
|
9
1
|
import { SalesQuoteLine } from "../../data/entities.js";
|
|
10
2
|
import { quoteLineCreateSchema } from "../../data/validators.js";
|
|
11
|
-
import {
|
|
12
|
-
createPagedListResponseSchema,
|
|
13
|
-
createSalesCrudOpenApi,
|
|
14
|
-
defaultOkResponseSchema
|
|
15
|
-
} from "../openapi.js";
|
|
16
|
-
import { withScopedPayload } from "../utils.js";
|
|
17
3
|
import { E } from "../../../../generated/entities.ids.generated.js";
|
|
18
4
|
import * as F from "../../../../generated/entities/sales_quote_line/index.js";
|
|
19
|
-
import {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
page: z.coerce.number().min(1).default(1),
|
|
33
|
-
pageSize: z.coerce.number().min(1).max(100).default(50),
|
|
34
|
-
id: z.string().uuid().optional(),
|
|
35
|
-
quoteId: z.string().uuid().optional(),
|
|
36
|
-
sortField: z.string().optional(),
|
|
37
|
-
sortDir: z.enum(["asc", "desc"]).optional()
|
|
38
|
-
}).passthrough();
|
|
39
|
-
const routeMetadata = {
|
|
40
|
-
GET: { requireAuth: true, requireFeatures: ["sales.quotes.view"] },
|
|
41
|
-
POST: { requireAuth: true, requireFeatures: ["sales.quotes.manage"] },
|
|
42
|
-
PUT: { requireAuth: true, requireFeatures: ["sales.quotes.manage"] },
|
|
43
|
-
DELETE: { requireAuth: true, requireFeatures: ["sales.quotes.manage"] }
|
|
44
|
-
};
|
|
45
|
-
const upsertSchema = quoteLineCreateSchema.extend({
|
|
46
|
-
id: z.string().uuid().optional()
|
|
47
|
-
});
|
|
48
|
-
const deleteSchema = z.object({
|
|
49
|
-
id: z.string().uuid(),
|
|
50
|
-
quoteId: z.string().uuid()
|
|
51
|
-
});
|
|
52
|
-
const crud = makeCrudRoute({
|
|
53
|
-
metadata: routeMetadata,
|
|
54
|
-
orm: {
|
|
55
|
-
entity: SalesQuoteLine,
|
|
56
|
-
idField: "id",
|
|
57
|
-
orgField: "organizationId",
|
|
58
|
-
tenantField: "tenantId",
|
|
59
|
-
softDeleteField: "deletedAt"
|
|
60
|
-
},
|
|
61
|
-
indexer: {
|
|
62
|
-
entityType: E.sales.sales_quote_line
|
|
63
|
-
},
|
|
64
|
-
list: {
|
|
65
|
-
schema: listSchema,
|
|
66
|
-
entityId: E.sales.sales_quote_line,
|
|
67
|
-
fields: [
|
|
68
|
-
F.id,
|
|
69
|
-
"quote_id",
|
|
70
|
-
F.line_number,
|
|
71
|
-
F.kind,
|
|
72
|
-
F.status_entry_id,
|
|
73
|
-
F.status,
|
|
74
|
-
F.product_id,
|
|
75
|
-
F.product_variant_id,
|
|
76
|
-
F.catalog_snapshot,
|
|
77
|
-
F.name,
|
|
78
|
-
F.description,
|
|
79
|
-
F.comment,
|
|
80
|
-
F.quantity,
|
|
81
|
-
F.quantity_unit,
|
|
82
|
-
F.normalized_quantity,
|
|
83
|
-
F.normalized_unit,
|
|
84
|
-
F.uom_snapshot,
|
|
85
|
-
F.currency_code,
|
|
86
|
-
F.unit_price_net,
|
|
87
|
-
F.unit_price_gross,
|
|
88
|
-
F.discount_amount,
|
|
89
|
-
F.discount_percent,
|
|
90
|
-
F.tax_rate,
|
|
91
|
-
F.tax_amount,
|
|
92
|
-
F.total_net_amount,
|
|
93
|
-
F.total_gross_amount,
|
|
94
|
-
F.configuration,
|
|
95
|
-
F.promotion_code,
|
|
96
|
-
F.promotion_snapshot,
|
|
97
|
-
F.metadata,
|
|
98
|
-
F.custom_field_set_id,
|
|
99
|
-
F.created_at,
|
|
100
|
-
F.updated_at
|
|
101
|
-
],
|
|
102
|
-
sortFieldMap: {
|
|
103
|
-
createdAt: F.created_at,
|
|
104
|
-
updatedAt: F.updated_at,
|
|
105
|
-
lineNumber: F.line_number
|
|
106
|
-
},
|
|
107
|
-
buildFilters: async (query, ctx) => {
|
|
108
|
-
const filters = {};
|
|
109
|
-
if (query.id) filters.id = { $eq: query.id };
|
|
110
|
-
if (query.quoteId) filters.quote_id = { $eq: query.quoteId };
|
|
111
|
-
try {
|
|
112
|
-
const em = ctx.container.resolve("em");
|
|
113
|
-
const cfFilters = await buildCustomFieldFiltersFromQuery({
|
|
114
|
-
entityId: E.sales.sales_quote_line,
|
|
115
|
-
query,
|
|
116
|
-
em,
|
|
117
|
-
tenantId: ctx.auth?.tenantId ?? null
|
|
118
|
-
});
|
|
119
|
-
Object.assign(filters, cfFilters);
|
|
120
|
-
} catch {
|
|
121
|
-
}
|
|
122
|
-
return filters;
|
|
123
|
-
},
|
|
124
|
-
transformItem: (item) => {
|
|
125
|
-
if (!item) return item;
|
|
126
|
-
const normalized = { ...item };
|
|
127
|
-
const cfEntries = extractAllCustomFieldEntries(item);
|
|
128
|
-
for (const key of Object.keys(normalized)) {
|
|
129
|
-
if (key.startsWith("cf:")) delete normalized[key];
|
|
130
|
-
}
|
|
131
|
-
const quantityUnit = canonicalizeUnitCode(
|
|
132
|
-
normalized["quantity_unit"] ?? normalized["quantityUnit"]
|
|
133
|
-
);
|
|
134
|
-
const normalizedUnit = canonicalizeUnitCode(
|
|
135
|
-
normalized["normalized_unit"] ?? normalized["normalizedUnit"]
|
|
136
|
-
) ?? quantityUnit;
|
|
137
|
-
return {
|
|
138
|
-
...normalized,
|
|
139
|
-
quantity_unit: quantityUnit,
|
|
140
|
-
normalized_unit: normalizedUnit,
|
|
141
|
-
...cfEntries
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
actions: {
|
|
146
|
-
create: {
|
|
147
|
-
commandId: "sales.quotes.lines.upsert",
|
|
148
|
-
schema: rawBodySchema,
|
|
149
|
-
mapInput: async ({ raw, ctx }) => {
|
|
150
|
-
const { translate } = await resolveTranslations();
|
|
151
|
-
const payload = upsertSchema.parse(
|
|
152
|
-
withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate)
|
|
153
|
-
);
|
|
154
|
-
return { body: payload };
|
|
155
|
-
},
|
|
156
|
-
response: ({ result }) => ({
|
|
157
|
-
id: result?.lineId ?? null,
|
|
158
|
-
quoteId: result?.quoteId ?? null
|
|
159
|
-
}),
|
|
160
|
-
status: 201
|
|
161
|
-
},
|
|
162
|
-
update: {
|
|
163
|
-
commandId: "sales.quotes.lines.upsert",
|
|
164
|
-
schema: rawBodySchema,
|
|
165
|
-
mapInput: async ({ raw, ctx }) => {
|
|
166
|
-
const { translate } = await resolveTranslations();
|
|
167
|
-
const payload = upsertSchema.parse(
|
|
168
|
-
withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate)
|
|
169
|
-
);
|
|
170
|
-
return { body: payload };
|
|
171
|
-
},
|
|
172
|
-
response: ({ result }) => ({
|
|
173
|
-
id: result?.lineId ?? null,
|
|
174
|
-
quoteId: result?.quoteId ?? null
|
|
175
|
-
})
|
|
176
|
-
},
|
|
177
|
-
delete: {
|
|
178
|
-
commandId: "sales.quotes.lines.delete",
|
|
179
|
-
schema: rawBodySchema,
|
|
180
|
-
mapInput: async ({ raw, ctx }) => {
|
|
181
|
-
const { translate } = await resolveTranslations();
|
|
182
|
-
const payload = deleteSchema.parse(
|
|
183
|
-
withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate)
|
|
184
|
-
);
|
|
185
|
-
if (!payload.id || !payload.quoteId) {
|
|
186
|
-
throw new CrudHttpError(400, {
|
|
187
|
-
error: translate(
|
|
188
|
-
"sales.documents.detail.error",
|
|
189
|
-
"Document not found or inaccessible."
|
|
190
|
-
)
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
return { body: payload };
|
|
194
|
-
},
|
|
195
|
-
response: () => ({ ok: true })
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
const { GET, POST, PUT, DELETE } = crud;
|
|
200
|
-
const uomSnapshotOpenApiSchema = z.object({
|
|
201
|
-
version: z.literal(1),
|
|
202
|
-
productId: z.string().nullable(),
|
|
203
|
-
productVariantId: z.string().nullable(),
|
|
204
|
-
baseUnitCode: z.string().nullable(),
|
|
205
|
-
enteredUnitCode: z.string().nullable(),
|
|
206
|
-
enteredQuantity: z.string(),
|
|
207
|
-
toBaseFactor: z.string(),
|
|
208
|
-
normalizedQuantity: z.string(),
|
|
209
|
-
rounding: z.object({
|
|
210
|
-
mode: z.enum(["half_up", "down", "up"]),
|
|
211
|
-
scale: z.number().int()
|
|
212
|
-
}),
|
|
213
|
-
source: z.object({
|
|
214
|
-
conversionId: z.string().nullable(),
|
|
215
|
-
resolvedAt: z.string()
|
|
216
|
-
}),
|
|
217
|
-
unitPriceReference: z.object({
|
|
218
|
-
enabled: z.boolean(),
|
|
219
|
-
referenceUnitCode: z.enum(REFERENCE_UNIT_CODES).nullable(),
|
|
220
|
-
baseQuantity: z.string().nullable(),
|
|
221
|
-
grossPerReference: z.string().nullable().optional(),
|
|
222
|
-
netPerReference: z.string().nullable().optional()
|
|
223
|
-
}).optional()
|
|
224
|
-
}).nullable().optional();
|
|
225
|
-
const quoteLineSchema = z.object({
|
|
226
|
-
id: z.string().uuid(),
|
|
227
|
-
quote_id: z.string().uuid(),
|
|
228
|
-
line_number: z.number(),
|
|
229
|
-
kind: z.string(),
|
|
230
|
-
status_entry_id: z.string().uuid().nullable().optional(),
|
|
231
|
-
status: z.string().nullable().optional(),
|
|
232
|
-
product_id: z.string().uuid().nullable().optional(),
|
|
233
|
-
product_variant_id: z.string().uuid().nullable().optional(),
|
|
234
|
-
catalog_snapshot: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
235
|
-
name: z.string().nullable().optional(),
|
|
236
|
-
description: z.string().nullable().optional(),
|
|
237
|
-
comment: z.string().nullable().optional(),
|
|
238
|
-
quantity: z.number(),
|
|
239
|
-
quantity_unit: z.string().nullable().optional(),
|
|
240
|
-
normalized_quantity: z.number(),
|
|
241
|
-
normalized_unit: z.string().nullable().optional(),
|
|
242
|
-
uom_snapshot: uomSnapshotOpenApiSchema,
|
|
243
|
-
currency_code: z.string(),
|
|
244
|
-
unit_price_net: z.number(),
|
|
245
|
-
unit_price_gross: z.number(),
|
|
246
|
-
discount_amount: z.number(),
|
|
247
|
-
discount_percent: z.number(),
|
|
248
|
-
tax_rate: z.number(),
|
|
249
|
-
tax_amount: z.number(),
|
|
250
|
-
total_net_amount: z.number(),
|
|
251
|
-
total_gross_amount: z.number(),
|
|
252
|
-
configuration: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
253
|
-
promotion_code: z.string().nullable().optional(),
|
|
254
|
-
promotion_snapshot: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
255
|
-
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
256
|
-
custom_field_set_id: z.string().uuid().nullable().optional(),
|
|
257
|
-
created_at: z.string(),
|
|
258
|
-
updated_at: z.string()
|
|
259
|
-
});
|
|
260
|
-
const openApi = createSalesCrudOpenApi({
|
|
261
|
-
resourceName: "Quote line",
|
|
262
|
-
querySchema: listSchema,
|
|
263
|
-
listResponseSchema: createPagedListResponseSchema(quoteLineSchema),
|
|
264
|
-
create: {
|
|
265
|
-
schema: upsertSchema,
|
|
266
|
-
responseSchema: z.object({
|
|
267
|
-
id: z.string().uuid().nullable(),
|
|
268
|
-
quoteId: z.string().uuid().nullable()
|
|
269
|
-
}),
|
|
270
|
-
description: "Creates a quote line and recalculates totals."
|
|
271
|
-
},
|
|
272
|
-
update: {
|
|
273
|
-
schema: upsertSchema,
|
|
274
|
-
responseSchema: z.object({
|
|
275
|
-
id: z.string().uuid().nullable(),
|
|
276
|
-
quoteId: z.string().uuid().nullable()
|
|
277
|
-
}),
|
|
278
|
-
description: "Updates a quote line and recalculates totals."
|
|
279
|
-
},
|
|
280
|
-
del: {
|
|
281
|
-
schema: deleteSchema,
|
|
282
|
-
responseSchema: defaultOkResponseSchema,
|
|
283
|
-
description: "Deletes a quote line and recalculates totals."
|
|
5
|
+
import { makeSalesLineRoute } from "../../lib/makeSalesLineRoute.js";
|
|
6
|
+
const route = makeSalesLineRoute({
|
|
7
|
+
entity: SalesQuoteLine,
|
|
8
|
+
entityId: E.sales.sales_quote_line,
|
|
9
|
+
fieldConstants: F,
|
|
10
|
+
parentFkColumn: "quote_id",
|
|
11
|
+
parentFkParam: "quoteId",
|
|
12
|
+
createSchema: quoteLineCreateSchema,
|
|
13
|
+
features: { view: "sales.quotes.view", manage: "sales.quotes.manage" },
|
|
14
|
+
commandPrefix: "sales.quotes.lines",
|
|
15
|
+
openApi: {
|
|
16
|
+
resourceName: "Quote line",
|
|
17
|
+
description: "a quote line and recalculates totals"
|
|
284
18
|
}
|
|
285
19
|
});
|
|
20
|
+
const { GET, POST, PUT, DELETE } = route;
|
|
21
|
+
const openApi = route.openApi;
|
|
286
22
|
export {
|
|
287
23
|
DELETE,
|
|
288
24
|
GET,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/sales/api/quote-lines/route.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from \"zod\";\nimport { makeCrudRoute } from \"@open-mercato/shared/lib/crud/factory\";\nimport { resolveTranslations } from \"@open-mercato/shared/lib/i18n/server\";\nimport { CrudHttpError } from \"@open-mercato/shared/lib/crud/errors\";\nimport {\n buildCustomFieldFiltersFromQuery,\n extractAllCustomFieldEntries,\n} from \"@open-mercato/shared/lib/crud/custom-fields\";\nimport { SalesQuoteLine } from \"../../data/entities\";\nimport { quoteLineCreateSchema } from \"../../data/validators\";\nimport {\n createPagedListResponseSchema,\n createSalesCrudOpenApi,\n defaultOkResponseSchema,\n} from \"../openapi\";\nimport { withScopedPayload } from \"../utils\";\nimport { E } from \"#generated/entities.ids.generated\";\nimport * as F from \"#generated/entities/sales_quote_line\";\nimport { canonicalizeUnitCode, REFERENCE_UNIT_CODES } from \"@open-mercato/shared/lib/units/unitCodes\";\n\nconst rawBodySchema = z.object({}).passthrough();\nconst resolveRawBody = (raw: unknown): Record<string, unknown> => {\n if (!raw || typeof raw !== \"object\") return {};\n if (\"body\" in raw) {\n const payload = raw as { body?: unknown };\n if (payload.body && typeof payload.body === \"object\") {\n return payload.body as Record<string, unknown>;\n }\n }\n return raw as Record<string, unknown>;\n};\n\nconst listSchema = z\n .object({\n page: z.coerce.number().min(1).default(1),\n pageSize: z.coerce.number().min(1).max(100).default(50),\n id: z.string().uuid().optional(),\n quoteId: z.string().uuid().optional(),\n sortField: z.string().optional(),\n sortDir: z.enum([\"asc\", \"desc\"]).optional(),\n })\n .passthrough();\n\nconst routeMetadata = {\n GET: { requireAuth: true, requireFeatures: [\"sales.quotes.view\"] },\n POST: { requireAuth: true, requireFeatures: [\"sales.quotes.manage\"] },\n PUT: { requireAuth: true, requireFeatures: [\"sales.quotes.manage\"] },\n DELETE: { requireAuth: true, requireFeatures: [\"sales.quotes.manage\"] },\n};\n\nconst upsertSchema = quoteLineCreateSchema.extend({\n id: z.string().uuid().optional(),\n});\nconst deleteSchema = z.object({\n id: z.string().uuid(),\n quoteId: z.string().uuid(),\n});\n\nconst crud = makeCrudRoute({\n metadata: routeMetadata,\n orm: {\n entity: SalesQuoteLine,\n idField: \"id\",\n orgField: \"organizationId\",\n tenantField: \"tenantId\",\n softDeleteField: \"deletedAt\",\n },\n indexer: {\n entityType: E.sales.sales_quote_line,\n },\n list: {\n schema: listSchema,\n entityId: E.sales.sales_quote_line,\n fields: [\n F.id,\n \"quote_id\",\n F.line_number,\n F.kind,\n F.status_entry_id,\n F.status,\n F.product_id,\n F.product_variant_id,\n F.catalog_snapshot,\n F.name,\n F.description,\n F.comment,\n F.quantity,\n F.quantity_unit,\n F.normalized_quantity,\n F.normalized_unit,\n F.uom_snapshot,\n F.currency_code,\n F.unit_price_net,\n F.unit_price_gross,\n F.discount_amount,\n F.discount_percent,\n F.tax_rate,\n F.tax_amount,\n F.total_net_amount,\n F.total_gross_amount,\n F.configuration,\n F.promotion_code,\n F.promotion_snapshot,\n F.metadata,\n F.custom_field_set_id,\n F.created_at,\n F.updated_at,\n ],\n sortFieldMap: {\n createdAt: F.created_at,\n updatedAt: F.updated_at,\n lineNumber: F.line_number,\n },\n buildFilters: async (query, ctx) => {\n const filters: Record<string, unknown> = {};\n if (query.id) filters.id = { $eq: query.id };\n if (query.quoteId) filters.quote_id = { $eq: query.quoteId };\n try {\n const em = ctx.container.resolve(\"em\");\n const cfFilters = await buildCustomFieldFiltersFromQuery({\n entityId: E.sales.sales_quote_line,\n query,\n em,\n tenantId: ctx.auth?.tenantId ?? null,\n });\n Object.assign(filters, cfFilters);\n } catch {\n // ignore\n }\n return filters;\n },\n transformItem: (item: Record<string, unknown> | null | undefined) => {\n if (!item) return item;\n const normalized = { ...item };\n const cfEntries = extractAllCustomFieldEntries(item);\n for (const key of Object.keys(normalized)) {\n if (key.startsWith(\"cf:\")) delete normalized[key];\n }\n const quantityUnit = canonicalizeUnitCode(\n normalized[\"quantity_unit\"] ?? normalized[\"quantityUnit\"],\n );\n const normalizedUnit =\n canonicalizeUnitCode(\n normalized[\"normalized_unit\"] ?? normalized[\"normalizedUnit\"],\n ) ?? quantityUnit;\n return {\n ...normalized,\n quantity_unit: quantityUnit,\n normalized_unit: normalizedUnit,\n ...cfEntries,\n };\n },\n },\n actions: {\n create: {\n commandId: \"sales.quotes.lines.upsert\",\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations();\n const payload = upsertSchema.parse(\n withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate),\n );\n return { body: payload };\n },\n response: ({ result }) => ({\n id: result?.lineId ?? null,\n quoteId: result?.quoteId ?? null,\n }),\n status: 201,\n },\n update: {\n commandId: \"sales.quotes.lines.upsert\",\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations();\n const payload = upsertSchema.parse(\n withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate),\n );\n return { body: payload };\n },\n response: ({ result }) => ({\n id: result?.lineId ?? null,\n quoteId: result?.quoteId ?? null,\n }),\n },\n delete: {\n commandId: \"sales.quotes.lines.delete\",\n schema: rawBodySchema,\n mapInput: async ({ raw, ctx }) => {\n const { translate } = await resolveTranslations();\n const payload = deleteSchema.parse(\n withScopedPayload(resolveRawBody(raw) ?? {}, ctx, translate),\n );\n if (!payload.id || !payload.quoteId) {\n throw new CrudHttpError(400, {\n error: translate(\n \"sales.documents.detail.error\",\n \"Document not found or inaccessible.\",\n ),\n });\n }\n return { body: payload };\n },\n response: () => ({ ok: true }),\n },\n },\n});\n\nconst { GET, POST, PUT, DELETE } = crud;\n\nexport { GET, POST, PUT, DELETE };\n\nconst uomSnapshotOpenApiSchema = z\n .object({\n version: z.literal(1),\n productId: z.string().nullable(),\n productVariantId: z.string().nullable(),\n baseUnitCode: z.string().nullable(),\n enteredUnitCode: z.string().nullable(),\n enteredQuantity: z.string(),\n toBaseFactor: z.string(),\n normalizedQuantity: z.string(),\n rounding: z.object({\n mode: z.enum([\"half_up\", \"down\", \"up\"]),\n scale: z.number().int(),\n }),\n source: z.object({\n conversionId: z.string().nullable(),\n resolvedAt: z.string(),\n }),\n unitPriceReference: z\n .object({\n enabled: z.boolean(),\n referenceUnitCode: z.enum(REFERENCE_UNIT_CODES).nullable(),\n baseQuantity: z.string().nullable(),\n grossPerReference: z.string().nullable().optional(),\n netPerReference: z.string().nullable().optional(),\n })\n .optional(),\n })\n .nullable()\n .optional();\n\nconst quoteLineSchema = z.object({\n id: z.string().uuid(),\n quote_id: z.string().uuid(),\n line_number: z.number(),\n kind: z.string(),\n status_entry_id: z.string().uuid().nullable().optional(),\n status: z.string().nullable().optional(),\n product_id: z.string().uuid().nullable().optional(),\n product_variant_id: z.string().uuid().nullable().optional(),\n catalog_snapshot: z.record(z.string(), z.unknown()).nullable().optional(),\n name: z.string().nullable().optional(),\n description: z.string().nullable().optional(),\n comment: z.string().nullable().optional(),\n quantity: z.number(),\n quantity_unit: z.string().nullable().optional(),\n normalized_quantity: z.number(),\n normalized_unit: z.string().nullable().optional(),\n uom_snapshot: uomSnapshotOpenApiSchema,\n currency_code: z.string(),\n unit_price_net: z.number(),\n unit_price_gross: z.number(),\n discount_amount: z.number(),\n discount_percent: z.number(),\n tax_rate: z.number(),\n tax_amount: z.number(),\n total_net_amount: z.number(),\n total_gross_amount: z.number(),\n configuration: z.record(z.string(), z.unknown()).nullable().optional(),\n promotion_code: z.string().nullable().optional(),\n promotion_snapshot: z.record(z.string(), z.unknown()).nullable().optional(),\n metadata: z.record(z.string(), z.unknown()).nullable().optional(),\n custom_field_set_id: z.string().uuid().nullable().optional(),\n created_at: z.string(),\n updated_at: z.string(),\n});\n\nexport const openApi = createSalesCrudOpenApi({\n resourceName: \"Quote line\",\n querySchema: listSchema,\n listResponseSchema: createPagedListResponseSchema(quoteLineSchema),\n create: {\n schema: upsertSchema,\n responseSchema: z.object({\n id: z.string().uuid().nullable(),\n quoteId: z.string().uuid().nullable(),\n }),\n description: \"Creates a quote line and recalculates totals.\",\n },\n update: {\n schema: upsertSchema,\n responseSchema: z.object({\n id: z.string().uuid().nullable(),\n quoteId: z.string().uuid().nullable(),\n }),\n description: \"Updates a quote line and recalculates totals.\",\n },\n del: {\n schema: deleteSchema,\n responseSchema: defaultOkResponseSchema,\n description: \"Deletes a quote line and recalculates totals.\",\n },\n});\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { SalesQuoteLine } from \"../../data/entities\";\nimport { quoteLineCreateSchema } from \"../../data/validators\";\nimport { E } from \"#generated/entities.ids.generated\";\nimport * as F from \"#generated/entities/sales_quote_line\";\nimport { makeSalesLineRoute } from \"../../lib/makeSalesLineRoute\";\n\nconst route = makeSalesLineRoute({\n entity: SalesQuoteLine,\n entityId: E.sales.sales_quote_line,\n fieldConstants: F,\n parentFkColumn: \"quote_id\",\n parentFkParam: \"quoteId\",\n createSchema: quoteLineCreateSchema,\n features: { view: \"sales.quotes.view\", manage: \"sales.quotes.manage\" },\n commandPrefix: \"sales.quotes.lines\",\n openApi: {\n resourceName: \"Quote line\",\n description: \"a quote line and recalculates totals\",\n },\n});\n\nexport const { GET, POST, PUT, DELETE } = route;\nexport const openApi = route.openApi;\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,SAAS;AAClB,YAAY,OAAO;AACnB,SAAS,0BAA0B;AAEnC,MAAM,QAAQ,mBAAmB;AAAA,EAC/B,QAAQ;AAAA,EACR,UAAU,EAAE,MAAM;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU,EAAE,MAAM,qBAAqB,QAAQ,sBAAsB;AAAA,EACrE,eAAe;AAAA,EACf,SAAS;AAAA,IACP,cAAc;AAAA,IACd,aAAa;AAAA,EACf;AACF,CAAC;AAEM,MAAM,EAAE,KAAK,MAAM,KAAK,OAAO,IAAI;AACnC,MAAM,UAAU,MAAM;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|