@open-mercato/core 0.6.1-develop.3139.9fc38487c8 → 0.6.1-develop.3144.b39fb4dfa6
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/catalog/api/dictionaries/[key]/route.js +2 -2
- package/dist/modules/catalog/api/dictionaries/[key]/route.js.map +2 -2
- package/dist/modules/customers/api/activities/route.js +5 -5
- package/dist/modules/customers/api/activities/route.js.map +2 -2
- package/dist/modules/customers/api/assignable-staff/route.js +2 -2
- package/dist/modules/customers/api/assignable-staff/route.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js +2 -2
- package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +2 -2
- package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-customers/route.js +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-customers/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-deals/route.js +2 -2
- package/dist/modules/customers/api/dashboard/widgets/new-deals/route.js.map +2 -2
- package/dist/modules/customers/api/dashboard/widgets/next-interactions/route.js +2 -2
- package/dist/modules/customers/api/dashboard/widgets/next-interactions/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js +2 -2
- package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js +2 -2
- package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js +6 -6
- package/dist/modules/customers/api/dictionaries/[kind]/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/[kind]/route.js +3 -3
- package/dist/modules/customers/api/dictionaries/[kind]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/currency/route.js +2 -2
- package/dist/modules/customers/api/dictionaries/currency/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js +3 -3
- package/dist/modules/customers/api/dictionaries/kind-settings/route.js.map +2 -2
- package/dist/modules/customers/api/entity-roles-factory.js +5 -5
- package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js +2 -2
- package/dist/modules/customers/api/interactions/cancel/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js +2 -2
- package/dist/modules/customers/api/interactions/complete/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/route.js +2 -2
- package/dist/modules/customers/api/interactions/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js +2 -2
- package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
- package/dist/modules/customers/api/labels/assign/route.js +2 -2
- package/dist/modules/customers/api/labels/assign/route.js.map +2 -2
- package/dist/modules/customers/api/labels/route.js +3 -3
- package/dist/modules/customers/api/labels/route.js.map +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js +2 -2
- package/dist/modules/customers/api/labels/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +3 -3
- package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +2 -2
- package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/companies/route.js +3 -3
- package/dist/modules/customers/api/people/[id]/companies/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js +2 -2
- package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +2 -2
- package/dist/modules/customers/api/pipeline-stages/route.js +5 -5
- package/dist/modules/customers/api/pipeline-stages/route.js.map +2 -2
- package/dist/modules/customers/api/pipelines/route.js +5 -5
- package/dist/modules/customers/api/pipelines/route.js.map +2 -2
- package/dist/modules/customers/api/settings/address-format/route.js +3 -3
- package/dist/modules/customers/api/settings/address-format/route.js.map +2 -2
- package/dist/modules/customers/api/tags/assign/route.js +2 -2
- package/dist/modules/customers/api/tags/assign/route.js.map +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js +2 -2
- package/dist/modules/customers/api/tags/unassign/route.js.map +2 -2
- package/dist/modules/customers/api/todos/route.js +5 -5
- package/dist/modules/customers/api/todos/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js +3 -3
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +3 -3
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js +4 -4
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/route.js +3 -3
- package/dist/modules/dictionaries/api/route.js.map +2 -2
- package/dist/modules/feature_toggles/api/overrides/route.js +2 -2
- package/dist/modules/feature_toggles/api/overrides/route.js.map +2 -2
- package/dist/modules/planner/api/availability-date-specific.js +2 -2
- package/dist/modules/planner/api/availability-date-specific.js.map +2 -2
- package/dist/modules/planner/api/availability-weekly.js +2 -2
- package/dist/modules/planner/api/availability-weekly.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/sales/api/document-history/route.js +2 -2
- package/dist/modules/sales/api/document-history/route.js.map +2 -2
- package/dist/modules/sales/api/document-numbers/route.js +2 -2
- package/dist/modules/sales/api/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/accept/route.js +2 -2
- package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js +2 -2
- package/dist/modules/sales/api/quotes/convert/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/public/[token]/route.js +2 -2
- package/dist/modules/sales/api/quotes/public/[token]/route.js.map +2 -2
- package/dist/modules/sales/api/quotes/send/route.js +2 -2
- package/dist/modules/sales/api/quotes/send/route.js.map +2 -2
- package/dist/modules/sales/api/returns/[id]/route.js +2 -2
- package/dist/modules/sales/api/returns/[id]/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +3 -3
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +3 -3
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js +2 -2
- package/dist/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +3 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js +4 -4
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
- package/dist/modules/translations/api/get/locales.js +2 -2
- package/dist/modules/translations/api/get/locales.js.map +2 -2
- package/dist/modules/translations/api/put/locales.js +2 -2
- package/dist/modules/translations/api/put/locales.js.map +2 -2
- package/package.json +5 -5
- package/src/modules/catalog/api/dictionaries/[key]/route.ts +2 -2
- package/src/modules/customers/api/activities/route.ts +5 -5
- package/src/modules/customers/api/assignable-staff/route.ts +2 -2
- package/src/modules/customers/api/companies/[id]/people/route.ts +2 -2
- package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +2 -2
- package/src/modules/customers/api/dashboard/widgets/new-customers/route.ts +2 -2
- package/src/modules/customers/api/dashboard/widgets/new-deals/route.ts +2 -2
- package/src/modules/customers/api/dashboard/widgets/next-interactions/route.ts +2 -2
- package/src/modules/customers/api/deals/[id]/companies/route.ts +2 -2
- package/src/modules/customers/api/deals/[id]/people/route.ts +2 -2
- package/src/modules/customers/api/dictionaries/[kind]/[id]/route.ts +6 -6
- package/src/modules/customers/api/dictionaries/[kind]/route.ts +3 -3
- package/src/modules/customers/api/dictionaries/currency/route.ts +2 -2
- package/src/modules/customers/api/dictionaries/kind-settings/route.ts +3 -3
- package/src/modules/customers/api/entity-roles-factory.ts +5 -5
- package/src/modules/customers/api/interactions/cancel/route.ts +2 -2
- package/src/modules/customers/api/interactions/complete/route.ts +2 -2
- package/src/modules/customers/api/interactions/conflicts/route.ts +2 -2
- package/src/modules/customers/api/interactions/counts/route.ts +2 -2
- package/src/modules/customers/api/interactions/route.ts +2 -2
- package/src/modules/customers/api/interactions/tasks/route.ts +2 -2
- package/src/modules/customers/api/labels/assign/route.ts +2 -2
- package/src/modules/customers/api/labels/route.ts +3 -3
- package/src/modules/customers/api/labels/unassign/route.ts +2 -2
- package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +3 -3
- package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +2 -2
- package/src/modules/customers/api/people/[id]/companies/route.ts +3 -3
- package/src/modules/customers/api/pipeline-stages/reorder/route.ts +2 -2
- package/src/modules/customers/api/pipeline-stages/route.ts +5 -5
- package/src/modules/customers/api/pipelines/route.ts +5 -5
- package/src/modules/customers/api/settings/address-format/route.ts +3 -3
- package/src/modules/customers/api/tags/assign/route.ts +2 -2
- package/src/modules/customers/api/tags/unassign/route.ts +2 -2
- package/src/modules/customers/api/todos/route.ts +5 -5
- package/src/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.ts +3 -3
- package/src/modules/dictionaries/api/[dictionaryId]/entries/reorder/route.ts +2 -2
- package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +3 -3
- package/src/modules/dictionaries/api/[dictionaryId]/entries/set-default/route.ts +2 -2
- package/src/modules/dictionaries/api/[dictionaryId]/route.ts +4 -4
- package/src/modules/dictionaries/api/route.ts +3 -3
- package/src/modules/feature_toggles/api/overrides/route.ts +2 -2
- package/src/modules/planner/api/availability-date-specific.ts +2 -2
- package/src/modules/planner/api/availability-weekly.ts +2 -2
- package/src/modules/resources/api/resources/tags/assign/route.ts +2 -2
- package/src/modules/resources/api/resources/tags/unassign/route.ts +2 -2
- package/src/modules/sales/api/document-history/route.ts +2 -2
- package/src/modules/sales/api/document-numbers/route.ts +2 -2
- package/src/modules/sales/api/quotes/accept/route.ts +2 -2
- package/src/modules/sales/api/quotes/convert/route.ts +2 -2
- package/src/modules/sales/api/quotes/public/[token]/route.ts +2 -2
- package/src/modules/sales/api/quotes/send/route.ts +2 -2
- package/src/modules/sales/api/returns/[id]/route.ts +2 -2
- package/src/modules/sales/api/settings/document-numbers/route.ts +3 -3
- package/src/modules/sales/api/settings/order-editing/route.ts +3 -3
- package/src/modules/sales/widgets/dashboard/makeDashboardWidgetRoute.ts +2 -2
- package/src/modules/staff/api/leave-requests/accept/route.ts +2 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +2 -2
- package/src/modules/staff/api/team-members/self/route.ts +3 -3
- package/src/modules/staff/api/team-members/tags/assign/route.ts +2 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +2 -2
- package/src/modules/translations/api/[entityType]/[entityId]/route.ts +4 -4
- package/src/modules/translations/api/get/locales.ts +2 -2
- package/src/modules/translations/api/put/locales.ts +2 -2
|
@@ -3,7 +3,7 @@ import { z } from 'zod'
|
|
|
3
3
|
import { Dictionary, DictionaryEntry } from '@open-mercato/core/modules/dictionaries/data/entities'
|
|
4
4
|
import { resolveDictionariesRouteContext } from '@open-mercato/core/modules/dictionaries/api/context'
|
|
5
5
|
import { createDictionaryEntrySchema } from '@open-mercato/core/modules/dictionaries/data/validators'
|
|
6
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
6
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
7
7
|
import type { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
9
9
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -88,7 +88,7 @@ export async function GET(req: Request, ctx: { params?: { dictionaryId?: string
|
|
|
88
88
|
})),
|
|
89
89
|
})
|
|
90
90
|
} catch (err) {
|
|
91
|
-
if (err
|
|
91
|
+
if (isCrudHttpError(err)) {
|
|
92
92
|
return NextResponse.json(err.body, { status: err.status })
|
|
93
93
|
}
|
|
94
94
|
console.error('[dictionaries/:id/entries.GET] Unexpected error', err)
|
|
@@ -152,7 +152,7 @@ export async function POST(req: Request, ctx: { params?: { dictionaryId?: string
|
|
|
152
152
|
}
|
|
153
153
|
return response
|
|
154
154
|
} catch (err) {
|
|
155
|
-
if (err
|
|
155
|
+
if (isCrudHttpError(err)) {
|
|
156
156
|
return NextResponse.json(err.body, { status: err.status })
|
|
157
157
|
}
|
|
158
158
|
console.error('[dictionaries/:id/entries.POST] Unexpected error', err)
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
setDefaultDictionaryEntrySchema,
|
|
8
8
|
type SetDefaultDictionaryEntryCommandInput,
|
|
9
9
|
} from '@open-mercato/core/modules/dictionaries/data/validators'
|
|
10
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
11
11
|
import type { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
12
12
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
13
13
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
@@ -124,7 +124,7 @@ export async function POST(req: Request, ctx: { params?: { dictionaryId?: string
|
|
|
124
124
|
}
|
|
125
125
|
return response
|
|
126
126
|
} catch (err) {
|
|
127
|
-
if (err
|
|
127
|
+
if (isCrudHttpError(err)) {
|
|
128
128
|
return NextResponse.json(err.body, { status: err.status })
|
|
129
129
|
}
|
|
130
130
|
console.error('[dictionaries/:id/entries/set-default.POST] Unexpected error', err)
|
|
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import { Dictionary } from '@open-mercato/core/modules/dictionaries/data/entities'
|
|
4
4
|
import { resolveDictionariesRouteContext } from '@open-mercato/core/modules/dictionaries/api/context'
|
|
5
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
6
6
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
7
7
|
import {
|
|
8
8
|
dictionariesErrorSchema,
|
|
@@ -83,7 +83,7 @@ export async function GET(req: Request, ctx: { params?: { dictionaryId?: string
|
|
|
83
83
|
updatedAt: dictionary.updatedAt,
|
|
84
84
|
})
|
|
85
85
|
} catch (err) {
|
|
86
|
-
if (err
|
|
86
|
+
if (isCrudHttpError(err)) {
|
|
87
87
|
return NextResponse.json(err.body, { status: err.status })
|
|
88
88
|
}
|
|
89
89
|
console.error('[dictionaries/:id.GET] Unexpected error', err)
|
|
@@ -157,7 +157,7 @@ export async function PATCH(req: Request, ctx: { params?: { dictionaryId?: strin
|
|
|
157
157
|
updatedAt: dictionary.updatedAt,
|
|
158
158
|
})
|
|
159
159
|
} catch (err) {
|
|
160
|
-
if (err
|
|
160
|
+
if (isCrudHttpError(err)) {
|
|
161
161
|
return NextResponse.json(err.body, { status: err.status })
|
|
162
162
|
}
|
|
163
163
|
console.error('[dictionaries/:id.PATCH] Unexpected error', err)
|
|
@@ -181,7 +181,7 @@ export async function DELETE(req: Request, ctx: { params?: { dictionaryId?: stri
|
|
|
181
181
|
|
|
182
182
|
return NextResponse.json({ ok: true })
|
|
183
183
|
} catch (err) {
|
|
184
|
-
if (err
|
|
184
|
+
if (isCrudHttpError(err)) {
|
|
185
185
|
return NextResponse.json(err.body, { status: err.status })
|
|
186
186
|
}
|
|
187
187
|
console.error('[dictionaries/:id.DELETE] Unexpected error', err)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server'
|
|
2
2
|
import { Dictionary } from '@open-mercato/core/modules/dictionaries/data/entities'
|
|
3
3
|
import { resolveDictionariesRouteContext } from '@open-mercato/core/modules/dictionaries/api/context'
|
|
4
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
4
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
5
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
6
6
|
import {
|
|
7
7
|
dictionariesErrorSchema,
|
|
@@ -55,7 +55,7 @@ export async function GET(req: Request) {
|
|
|
55
55
|
})),
|
|
56
56
|
})
|
|
57
57
|
} catch (err) {
|
|
58
|
-
if (err
|
|
58
|
+
if (isCrudHttpError(err)) {
|
|
59
59
|
return NextResponse.json(err.body, { status: err.status })
|
|
60
60
|
}
|
|
61
61
|
console.error('[dictionaries.GET] Unexpected error', err)
|
|
@@ -108,7 +108,7 @@ export async function POST(req: Request) {
|
|
|
108
108
|
updatedAt: dictionary.updatedAt,
|
|
109
109
|
}, { status: 201 })
|
|
110
110
|
} catch (err) {
|
|
111
|
-
if (err
|
|
111
|
+
if (isCrudHttpError(err)) {
|
|
112
112
|
return NextResponse.json(err.body, { status: err.status })
|
|
113
113
|
}
|
|
114
114
|
console.error('[dictionaries.POST] Unexpected error', err)
|
|
@@ -5,7 +5,7 @@ import { Tenant } from '@open-mercato/core/modules/directory/data/entities'
|
|
|
5
5
|
import type { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import { getOverrides } from '../../lib/queries'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { logCrudAccess } from '@open-mercato/shared/lib/crud/factory'
|
|
10
10
|
import { buildContext } from '../../lib/utils'
|
|
11
11
|
import { resolveFeatureCheckContext } from "@open-mercato/core/modules/directory/utils/organizationScope"
|
|
@@ -120,7 +120,7 @@ export async function PUT(req: Request) {
|
|
|
120
120
|
|
|
121
121
|
return response
|
|
122
122
|
} catch (error) {
|
|
123
|
-
if (error
|
|
123
|
+
if (isCrudHttpError(error)) {
|
|
124
124
|
return NextResponse.json(error.body, { status: error.status })
|
|
125
125
|
}
|
|
126
126
|
const message = error instanceof Error ? error.message : 'Unknown error'
|
|
@@ -6,7 +6,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
6
6
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
7
7
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
12
12
|
import { plannerAvailabilityDateSpecificReplaceSchema } from '../data/validators'
|
|
@@ -112,7 +112,7 @@ export async function POST(req: Request) {
|
|
|
112
112
|
}
|
|
113
113
|
return response
|
|
114
114
|
} catch (err) {
|
|
115
|
-
if (err
|
|
115
|
+
if (isCrudHttpError(err)) {
|
|
116
116
|
return NextResponse.json(err.body, { status: err.status })
|
|
117
117
|
}
|
|
118
118
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
10
10
|
import { plannerAvailabilityWeeklyReplaceSchema } from '../data/validators'
|
|
11
11
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
@@ -74,7 +74,7 @@ export async function POST(req: Request) {
|
|
|
74
74
|
}
|
|
75
75
|
return response
|
|
76
76
|
} catch (err) {
|
|
77
|
-
if (err
|
|
77
|
+
if (isCrudHttpError(err)) {
|
|
78
78
|
return NextResponse.json(err.body, { status: err.status })
|
|
79
79
|
}
|
|
80
80
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -64,7 +64,7 @@ export async function POST(req: Request) {
|
|
|
64
64
|
}
|
|
65
65
|
return response
|
|
66
66
|
} catch (err) {
|
|
67
|
-
if (err
|
|
67
|
+
if (isCrudHttpError(err)) {
|
|
68
68
|
return NextResponse.json(err.body, { status: err.status })
|
|
69
69
|
}
|
|
70
70
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -64,7 +64,7 @@ export async function POST(req: Request) {
|
|
|
64
64
|
}
|
|
65
65
|
return response
|
|
66
66
|
} catch (err) {
|
|
67
|
-
if (err
|
|
67
|
+
if (isCrudHttpError(err)) {
|
|
68
68
|
return NextResponse.json(err.body, { status: err.status })
|
|
69
69
|
}
|
|
70
70
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
|
5
5
|
import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
6
6
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { NextResponse } from 'next/server'
|
|
10
10
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
11
11
|
import type { ActionLog } from '@open-mercato/core/modules/audit_logs/data/entities'
|
|
@@ -127,7 +127,7 @@ export async function GET(req: Request) {
|
|
|
127
127
|
|
|
128
128
|
return NextResponse.json({ items, nextCursor })
|
|
129
129
|
} catch (err) {
|
|
130
|
-
if (err
|
|
130
|
+
if (isCrudHttpError(err)) {
|
|
131
131
|
return NextResponse.json(err.body, { status: err.status })
|
|
132
132
|
}
|
|
133
133
|
console.error('sales.document-history.get failed', err)
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
10
10
|
import type { RbacService } from '@open-mercato/core/modules/auth/services/rbacService'
|
|
11
11
|
import { documentNumberRequestSchema } from '../../data/validators'
|
|
@@ -101,7 +101,7 @@ export async function POST(req: Request) {
|
|
|
101
101
|
sequence: result.sequence,
|
|
102
102
|
})
|
|
103
103
|
} catch (err) {
|
|
104
|
-
if (err
|
|
104
|
+
if (isCrudHttpError(err)) {
|
|
105
105
|
return NextResponse.json(err.body, { status: err.status })
|
|
106
106
|
}
|
|
107
107
|
const { translate } = await resolveTranslations()
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod'
|
|
|
3
3
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
4
4
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
5
5
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
6
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
6
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
7
7
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
8
8
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
9
9
|
import { LockMode } from '@mikro-orm/core'
|
|
@@ -182,7 +182,7 @@ export async function POST(req: Request) {
|
|
|
182
182
|
|
|
183
183
|
return NextResponse.json({ orderId, orderNumber })
|
|
184
184
|
} catch (err) {
|
|
185
|
-
if (err
|
|
185
|
+
if (isCrudHttpError(err)) {
|
|
186
186
|
return NextResponse.json(err.body, { status: err.status })
|
|
187
187
|
}
|
|
188
188
|
const { translate } = await resolveTranslations()
|
|
@@ -6,7 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
11
11
|
import {
|
|
12
12
|
bridgeLegacyGuard,
|
|
@@ -169,7 +169,7 @@ export async function POST(req: Request) {
|
|
|
169
169
|
|
|
170
170
|
return jsonResponse
|
|
171
171
|
} catch (err) {
|
|
172
|
-
if (err
|
|
172
|
+
if (isCrudHttpError(err)) {
|
|
173
173
|
return NextResponse.json(err.body, { status: err.status })
|
|
174
174
|
}
|
|
175
175
|
const { translate } = await resolveTranslations()
|
|
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
4
4
|
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
5
|
-
import { CrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
5
|
+
import { CrudHttpError, isCrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
6
6
|
import type { OpenApiRouteDoc } from "@open-mercato/shared/lib/openapi";
|
|
7
7
|
import type { EntityManager } from "@mikro-orm/postgresql";
|
|
8
8
|
import { findOneWithDecryption, findWithDecryption } from "@open-mercato/shared/lib/encryption/find";
|
|
@@ -138,7 +138,7 @@ export async function GET(req: Request, ctx: { params: { token: string } }) {
|
|
|
138
138
|
isExpired,
|
|
139
139
|
});
|
|
140
140
|
} catch (err) {
|
|
141
|
-
if (err
|
|
141
|
+
if (isCrudHttpError(err)) {
|
|
142
142
|
return NextResponse.json(err.body, { status: err.status });
|
|
143
143
|
}
|
|
144
144
|
const { translate } = await resolveTranslations();
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import type { CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import { resolveTranslations, detectLocale } from '@open-mercato/shared/lib/i18n/server'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
10
10
|
import {
|
|
11
11
|
bridgeLegacyGuard,
|
|
@@ -225,7 +225,7 @@ export async function POST(req: Request) {
|
|
|
225
225
|
|
|
226
226
|
return NextResponse.json({ ok: true })
|
|
227
227
|
} catch (err) {
|
|
228
|
-
if (err
|
|
228
|
+
if (isCrudHttpError(err)) {
|
|
229
229
|
return NextResponse.json(err.body, { status: err.status })
|
|
230
230
|
}
|
|
231
231
|
const { translate } = await resolveTranslations()
|
|
@@ -6,7 +6,7 @@ import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
|
6
6
|
import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
7
7
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
11
11
|
import { SalesReturn, SalesReturnLine } from '../../../data/entities'
|
|
12
12
|
|
|
@@ -99,7 +99,7 @@ export async function GET(req: Request, ctx: { params: { id: string } }) {
|
|
|
99
99
|
})),
|
|
100
100
|
})
|
|
101
101
|
} catch (err) {
|
|
102
|
-
if (err
|
|
102
|
+
if (isCrudHttpError(err)) {
|
|
103
103
|
return NextResponse.json(err.body, { status: err.status })
|
|
104
104
|
}
|
|
105
105
|
console.error('sales.returns.get failed', err)
|
|
@@ -6,7 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
11
11
|
import { salesSettingsUpsertSchema, type SalesSettingsUpsertInput } from '../../../data/validators'
|
|
12
12
|
import { loadSalesSettings } from '../../../commands/settings'
|
|
@@ -79,7 +79,7 @@ export async function GET(req: Request) {
|
|
|
79
79
|
tokens: DOCUMENT_NUMBER_TOKENS,
|
|
80
80
|
})
|
|
81
81
|
} catch (err) {
|
|
82
|
-
if (err
|
|
82
|
+
if (isCrudHttpError(err)) {
|
|
83
83
|
return NextResponse.json(err.body, { status: err.status })
|
|
84
84
|
}
|
|
85
85
|
const { translate } = await resolveTranslations()
|
|
@@ -120,7 +120,7 @@ export async function PUT(req: Request) {
|
|
|
120
120
|
tokens: DOCUMENT_NUMBER_TOKENS,
|
|
121
121
|
})
|
|
122
122
|
} catch (err) {
|
|
123
|
-
if (err
|
|
123
|
+
if (isCrudHttpError(err)) {
|
|
124
124
|
return NextResponse.json(err.body, { status: err.status })
|
|
125
125
|
}
|
|
126
126
|
const { translate } = await resolveTranslations()
|
|
@@ -6,7 +6,7 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
6
6
|
import type { CommandBus, CommandRuntimeContext } from '@open-mercato/shared/lib/commands'
|
|
7
7
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
8
8
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
11
11
|
import { salesEditingSettingsSchema, salesSettingsUpsertSchema } from '../../../data/validators'
|
|
12
12
|
import { loadSalesSettings } from '../../../commands/settings'
|
|
@@ -99,7 +99,7 @@ export async function GET(req: Request) {
|
|
|
99
99
|
orderStatuses,
|
|
100
100
|
})
|
|
101
101
|
} catch (err) {
|
|
102
|
-
if (err
|
|
102
|
+
if (isCrudHttpError(err)) {
|
|
103
103
|
return NextResponse.json(err.body, { status: err.status })
|
|
104
104
|
}
|
|
105
105
|
const { translate } = await resolveTranslations()
|
|
@@ -139,7 +139,7 @@ export async function PUT(req: Request) {
|
|
|
139
139
|
orderStatuses,
|
|
140
140
|
})
|
|
141
141
|
} catch (err) {
|
|
142
|
-
if (err
|
|
142
|
+
if (isCrudHttpError(err)) {
|
|
143
143
|
return NextResponse.json(err.body, { status: err.status })
|
|
144
144
|
}
|
|
145
145
|
const { translate } = await resolveTranslations()
|
|
@@ -6,7 +6,7 @@ import type { CacheStrategy } from '@open-mercato/cache'
|
|
|
6
6
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
7
7
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
8
8
|
import { runWithCacheTenant } from '@open-mercato/cache'
|
|
9
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
10
10
|
import { findAndCountWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
11
11
|
import { resolveDateRange } from '@open-mercato/ui/backend/date-range'
|
|
12
12
|
import type { DatePeriodOption } from '../../api/dashboard/widgets/helpers'
|
|
@@ -204,7 +204,7 @@ export function makeDashboardWidgetRoute<TEntity extends object, TItem extends R
|
|
|
204
204
|
|
|
205
205
|
return NextResponse.json(response)
|
|
206
206
|
} catch (err) {
|
|
207
|
-
if (err
|
|
207
|
+
if (isCrudHttpError(err)) {
|
|
208
208
|
return NextResponse.json(err.body, { status: err.status })
|
|
209
209
|
}
|
|
210
210
|
console.error(`${config.errorPrefix} failed`, err)
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -61,7 +61,7 @@ export async function POST(req: Request) {
|
|
|
61
61
|
}
|
|
62
62
|
return response
|
|
63
63
|
} catch (err) {
|
|
64
|
-
if (err
|
|
64
|
+
if (isCrudHttpError(err)) {
|
|
65
65
|
return NextResponse.json(err.body, { status: err.status })
|
|
66
66
|
}
|
|
67
67
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -61,7 +61,7 @@ export async function POST(req: Request) {
|
|
|
61
61
|
}
|
|
62
62
|
return response
|
|
63
63
|
} catch (err) {
|
|
64
|
-
if (err
|
|
64
|
+
if (isCrudHttpError(err)) {
|
|
65
65
|
return NextResponse.json(err.body, { status: err.status })
|
|
66
66
|
}
|
|
67
67
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
@@ -77,7 +77,7 @@ export async function GET(req: Request) {
|
|
|
77
77
|
},
|
|
78
78
|
})
|
|
79
79
|
} catch (err) {
|
|
80
|
-
if (err
|
|
80
|
+
if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })
|
|
81
81
|
console.error('staff.teamMembers.self.load failed', err)
|
|
82
82
|
return NextResponse.json({ member: null })
|
|
83
83
|
}
|
|
@@ -136,7 +136,7 @@ export async function POST(req: Request) {
|
|
|
136
136
|
}
|
|
137
137
|
return response
|
|
138
138
|
} catch (err) {
|
|
139
|
-
if (err
|
|
139
|
+
if (isCrudHttpError(err)) {
|
|
140
140
|
return NextResponse.json(err.body, { status: err.status })
|
|
141
141
|
}
|
|
142
142
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -64,7 +64,7 @@ export async function POST(req: Request) {
|
|
|
64
64
|
}
|
|
65
65
|
return response
|
|
66
66
|
} catch (err) {
|
|
67
|
-
if (err
|
|
67
|
+
if (isCrudHttpError(err)) {
|
|
68
68
|
return NextResponse.json(err.body, { status: err.status })
|
|
69
69
|
}
|
|
70
70
|
const { translate } = await resolveTranslations()
|
|
@@ -5,7 +5,7 @@ import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
|
5
5
|
import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'
|
|
6
6
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
7
7
|
import type { CommandRuntimeContext, CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import { parseScopedCommandInput } from '@open-mercato/shared/lib/api/scoped'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -64,7 +64,7 @@ export async function POST(req: Request) {
|
|
|
64
64
|
}
|
|
65
65
|
return response
|
|
66
66
|
} catch (err) {
|
|
67
|
-
if (err
|
|
67
|
+
if (isCrudHttpError(err)) {
|
|
68
68
|
return NextResponse.json(err.body, { status: err.status })
|
|
69
69
|
}
|
|
70
70
|
const { translate } = await resolveTranslations()
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod'
|
|
|
3
3
|
import { sql } from 'kysely'
|
|
4
4
|
import { resolveTranslationsRouteContext, requireTranslationFeatures } from '@open-mercato/core/modules/translations/api/context'
|
|
5
5
|
import { translationBodySchema, entityTypeParamSchema, entityIdParamSchema } from '@open-mercato/core/modules/translations/data/validators'
|
|
6
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
6
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
7
7
|
import { CommandBus } from '@open-mercato/shared/lib/commands'
|
|
8
8
|
import { serializeOperationMetadata } from '@open-mercato/shared/lib/commands/operationMetadata'
|
|
9
9
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -49,7 +49,7 @@ export async function GET(req: Request, ctx: { params?: { entityType?: string; e
|
|
|
49
49
|
updatedAt: row.updated_at,
|
|
50
50
|
})
|
|
51
51
|
} catch (err) {
|
|
52
|
-
if (err
|
|
52
|
+
if (isCrudHttpError(err)) {
|
|
53
53
|
return NextResponse.json(err.body, { status: err.status })
|
|
54
54
|
}
|
|
55
55
|
if (err instanceof z.ZodError) {
|
|
@@ -122,7 +122,7 @@ export async function PUT(req: Request, ctx: { params?: { entityType?: string; e
|
|
|
122
122
|
|
|
123
123
|
return response
|
|
124
124
|
} catch (err) {
|
|
125
|
-
if (err
|
|
125
|
+
if (isCrudHttpError(err)) {
|
|
126
126
|
return NextResponse.json(err.body, { status: err.status })
|
|
127
127
|
}
|
|
128
128
|
if (err instanceof z.ZodError) {
|
|
@@ -179,7 +179,7 @@ export async function DELETE(req: Request, ctx: { params?: { entityType?: string
|
|
|
179
179
|
|
|
180
180
|
return response
|
|
181
181
|
} catch (err) {
|
|
182
|
-
if (err
|
|
182
|
+
if (isCrudHttpError(err)) {
|
|
183
183
|
return NextResponse.json(err.body, { status: err.status })
|
|
184
184
|
}
|
|
185
185
|
if (err instanceof z.ZodError) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import { resolveTranslationsRouteContext } from '@open-mercato/core/modules/translations/api/context'
|
|
4
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
4
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
5
|
import { locales as defaultLocales } from '@open-mercato/shared/lib/i18n/config'
|
|
6
6
|
import type { ModuleConfigService } from '@open-mercato/core/modules/configs/lib/module-config-service'
|
|
7
7
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -22,7 +22,7 @@ async function GET(req: Request) {
|
|
|
22
22
|
|
|
23
23
|
return NextResponse.json({ locales: Array.isArray(locales) ? locales : [...defaultLocales] })
|
|
24
24
|
} catch (err) {
|
|
25
|
-
if (err
|
|
25
|
+
if (isCrudHttpError(err)) {
|
|
26
26
|
return NextResponse.json(err.body, { status: err.status })
|
|
27
27
|
}
|
|
28
28
|
console.error('[translations/locales.GET] Unexpected error', err)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import { resolveTranslationsRouteContext } from '@open-mercato/core/modules/translations/api/context'
|
|
4
|
-
import { CrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
4
|
+
import { CrudHttpError, isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
5
5
|
import { isValidIso639 } from '@open-mercato/shared/lib/i18n/iso639'
|
|
6
6
|
import type { ModuleConfigService } from '@open-mercato/core/modules/configs/lib/module-config-service'
|
|
7
7
|
import type { OpenApiMethodDoc, OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
@@ -28,7 +28,7 @@ async function PUT(req: Request) {
|
|
|
28
28
|
|
|
29
29
|
return NextResponse.json({ locales: uniqueLocales })
|
|
30
30
|
} catch (err) {
|
|
31
|
-
if (err
|
|
31
|
+
if (isCrudHttpError(err)) {
|
|
32
32
|
return NextResponse.json(err.body, { status: err.status })
|
|
33
33
|
}
|
|
34
34
|
if (err instanceof z.ZodError) {
|