@open-mercato/core 0.6.6-develop.6304.1.4cf2b975cb → 0.6.6-develop.6305.1.4503070c9d
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/sales/commands/configuration.js +8 -8
- package/dist/modules/sales/commands/configuration.js.map +2 -2
- package/dist/modules/sales/commands/documentAddresses.js +8 -7
- package/dist/modules/sales/commands/documentAddresses.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +120 -42
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/commands/notes.js +8 -8
- package/dist/modules/sales/commands/notes.js.map +2 -2
- package/dist/modules/sales/commands/payments.js +16 -10
- package/dist/modules/sales/commands/payments.js.map +2 -2
- package/dist/modules/sales/commands/shipments.js +7 -7
- package/dist/modules/sales/commands/shipments.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/sales/commands/configuration.ts +8 -8
- package/src/modules/sales/commands/documentAddresses.ts +8 -7
- package/src/modules/sales/commands/documents.ts +120 -42
- package/src/modules/sales/commands/notes.ts +8 -8
- package/src/modules/sales/commands/payments.ts +13 -18
- package/src/modules/sales/commands/shipments.ts +11 -7
|
@@ -71,7 +71,7 @@ const channelCrudIndexer = {
|
|
|
71
71
|
entityType: E.sales.sales_channel
|
|
72
72
|
};
|
|
73
73
|
async function loadChannelSnapshot(em, id) {
|
|
74
|
-
const channel = await em
|
|
74
|
+
const channel = await findOneWithDecryption(em, SalesChannel, { id, deletedAt: null }, {});
|
|
75
75
|
if (!channel) return null;
|
|
76
76
|
const custom = await loadCustomFieldSnapshot(em, {
|
|
77
77
|
entityId: E.sales.sales_channel,
|
|
@@ -504,7 +504,7 @@ const createChannelCommand = {
|
|
|
504
504
|
const after = payload?.after;
|
|
505
505
|
if (!after) return;
|
|
506
506
|
const em = ctx.container.resolve("em").fork();
|
|
507
|
-
const record = await em
|
|
507
|
+
const record = await findOneWithDecryption(em, SalesChannel, { id: after.id }, {}, { tenantId: after.tenantId, organizationId: after.organizationId });
|
|
508
508
|
if (!record) return;
|
|
509
509
|
ensureTenantScope(ctx, record.tenantId);
|
|
510
510
|
ensureOrganizationScope(ctx, record.organizationId);
|
|
@@ -578,7 +578,7 @@ const updateChannelCommand = {
|
|
|
578
578
|
async execute(rawInput, ctx) {
|
|
579
579
|
const { parsed, custom } = parseWithCustomFields(channelUpdateSchema, rawInput);
|
|
580
580
|
const em = ctx.container.resolve("em").fork();
|
|
581
|
-
const record = await em
|
|
581
|
+
const record = await findOneWithDecryption(em, SalesChannel, { id: parsed.id, deletedAt: null }, {}, { tenantId: parsed.tenantId, organizationId: parsed.organizationId });
|
|
582
582
|
if (!record) throw new CrudHttpError(404, { error: "Channel not found" });
|
|
583
583
|
const dataEngine = ctx.container.resolve("dataEngine");
|
|
584
584
|
const scope = resolveScopeFromUpdate(record, parsed, ctx);
|
|
@@ -670,7 +670,7 @@ const updateChannelCommand = {
|
|
|
670
670
|
const before = payload?.before;
|
|
671
671
|
if (!before) return;
|
|
672
672
|
const em = ctx.container.resolve("em").fork();
|
|
673
|
-
let record = await em
|
|
673
|
+
let record = await findOneWithDecryption(em, SalesChannel, { id: before.id }, {}, { tenantId: before.tenantId, organizationId: before.organizationId });
|
|
674
674
|
if (!record) {
|
|
675
675
|
record = em.create(SalesChannel, channelSeedFromSnapshot(before));
|
|
676
676
|
em.persist(record);
|
|
@@ -721,7 +721,7 @@ const deleteChannelCommand = {
|
|
|
721
721
|
async execute(input, ctx) {
|
|
722
722
|
const id = requireId(input, "Channel id is required");
|
|
723
723
|
const em = ctx.container.resolve("em").fork();
|
|
724
|
-
const record = await em
|
|
724
|
+
const record = await findOneWithDecryption(em, SalesChannel, { id }, {});
|
|
725
725
|
if (!record) throw new CrudHttpError(404, { error: "Channel not found" });
|
|
726
726
|
ensureTenantScope(ctx, record.tenantId);
|
|
727
727
|
ensureOrganizationScope(ctx, record.organizationId);
|
|
@@ -765,7 +765,7 @@ const deleteChannelCommand = {
|
|
|
765
765
|
const before = payload?.before;
|
|
766
766
|
if (!before) return;
|
|
767
767
|
const em = ctx.container.resolve("em").fork();
|
|
768
|
-
let record = await em
|
|
768
|
+
let record = await findOneWithDecryption(em, SalesChannel, { id: before.id }, {}, { tenantId: before.tenantId, organizationId: before.organizationId });
|
|
769
769
|
if (!record) {
|
|
770
770
|
record = em.create(SalesChannel, channelSeedFromSnapshot(before));
|
|
771
771
|
em.persist(record);
|
|
@@ -1615,7 +1615,7 @@ const createTaxRateCommand = {
|
|
|
1615
1615
|
ensureOrganizationScope(ctx, parsed.organizationId);
|
|
1616
1616
|
const em = ctx.container.resolve("em").fork();
|
|
1617
1617
|
if (parsed.channelId) {
|
|
1618
|
-
const channel = await em
|
|
1618
|
+
const channel = await findOneWithDecryption(em, SalesChannel, { id: parsed.channelId, deletedAt: null }, {}, { tenantId: parsed.tenantId, organizationId: parsed.organizationId });
|
|
1619
1619
|
const channelInScope = assertFound(channel, "Channel not found for tax rate");
|
|
1620
1620
|
ensureSameScope(channelInScope, parsed.organizationId, parsed.tenantId);
|
|
1621
1621
|
}
|
|
@@ -1745,7 +1745,7 @@ const updateTaxRateCommand = {
|
|
|
1745
1745
|
record.organizationId = scope.organizationId;
|
|
1746
1746
|
record.tenantId = scope.tenantId;
|
|
1747
1747
|
if (parsed.channelId !== void 0 && parsed.channelId !== null) {
|
|
1748
|
-
const channel = await em
|
|
1748
|
+
const channel = await findOneWithDecryption(em, SalesChannel, { id: parsed.channelId, deletedAt: null }, {}, { tenantId: record.tenantId, organizationId: record.organizationId });
|
|
1749
1749
|
const channelInScope = assertFound(channel, "Channel not found for tax rate");
|
|
1750
1750
|
ensureSameScope(channelInScope, record.organizationId, record.tenantId);
|
|
1751
1751
|
}
|