mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Add data store row update endpoint (no-changelog) (#18601)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { z } from 'zod';
|
||||
import { Z } from 'zod-class';
|
||||
|
||||
import {
|
||||
dataStoreColumnNameSchema,
|
||||
dataStoreColumnValueSchema,
|
||||
} from '../../schemas/data-store.schema';
|
||||
|
||||
const updateDataStoreRowShape = {
|
||||
filter: z
|
||||
.record(dataStoreColumnNameSchema, dataStoreColumnValueSchema)
|
||||
.refine((obj) => Object.keys(obj).length > 0, {
|
||||
message: 'filter must not be empty',
|
||||
}),
|
||||
data: z
|
||||
.record(dataStoreColumnNameSchema, dataStoreColumnValueSchema)
|
||||
.refine((obj) => Object.keys(obj).length > 0, {
|
||||
message: 'data must not be empty',
|
||||
}),
|
||||
};
|
||||
|
||||
export class UpdateDataStoreRowDto extends Z.class(updateDataStoreRowShape) {}
|
||||
@@ -1,12 +1,13 @@
|
||||
import { z } from 'zod';
|
||||
import { Z } from 'zod-class';
|
||||
|
||||
import { dataStoreColumnNameSchema } from '../../schemas/data-store.schema';
|
||||
|
||||
const dataStoreValueSchema = z.union([z.string(), z.number(), z.boolean(), z.date(), z.null()]);
|
||||
import {
|
||||
dataStoreColumnNameSchema,
|
||||
dataStoreColumnValueSchema,
|
||||
} from '../../schemas/data-store.schema';
|
||||
|
||||
const upsertDataStoreRowsShape = {
|
||||
rows: z.array(z.record(dataStoreValueSchema)),
|
||||
rows: z.array(z.record(dataStoreColumnNameSchema, dataStoreColumnValueSchema)),
|
||||
matchFields: z.array(dataStoreColumnNameSchema).min(1),
|
||||
};
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ export { OidcConfigDto } from './oidc/config.dto';
|
||||
|
||||
export { CreateDataStoreDto } from './data-store/create-data-store.dto';
|
||||
export { UpdateDataStoreDto } from './data-store/update-data-store.dto';
|
||||
export { UpdateDataStoreRowDto } from './data-store/update-data-store-row.dto';
|
||||
export { UpsertDataStoreRowsDto } from './data-store/upsert-data-store-rows.dto';
|
||||
export { ListDataStoreQueryDto } from './data-store/list-data-store-query.dto';
|
||||
export { ListDataStoreContentQueryDto } from './data-store/list-data-store-content-query.dto';
|
||||
|
||||
@@ -57,5 +57,10 @@ export const dateTimeSchema = z
|
||||
.transform((s) => new Date(s))
|
||||
.pipe(z.date());
|
||||
|
||||
// Dates are received as date strings and validated before insertion
|
||||
export const dataStoreColumnValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
||||
export const dataStoreColumnValueSchema = z.union([
|
||||
z.string(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.null(),
|
||||
z.date(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user