mirror of
https://github.com/directus/directus.git
synced 2026-01-09 01:37:58 -05:00
Added the updateCommentsBatch function to the SDK (#25866)
* added missing updateCommentsBatch * do the changeset
This commit is contained in:
5
.changeset/early-owls-return.md
Normal file
5
.changeset/early-owls-return.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/sdk': patch
|
||||
---
|
||||
|
||||
Added the updateCommentsBatch function to the SDK
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DirectusComment } from '../../../schema/comment.js';
|
||||
import type { ApplyQueryFields, Query } from '../../../types/index.js';
|
||||
import type { ApplyQueryFields, Query, NestedPartial } from '../../../types/index.js';
|
||||
import type { RestCommand } from '../../types.js';
|
||||
import { throwIfEmpty } from '../../utils/index.js';
|
||||
|
||||
@@ -44,6 +44,24 @@ export const updateComments =
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Update multiple comments as batch.
|
||||
* @param items
|
||||
* @param query
|
||||
* @returns Returns the comment objects for the updated comments.
|
||||
*/
|
||||
export const updateCommentsBatch =
|
||||
<Schema, const TQuery extends Query<Schema, DirectusComment<Schema>>>(
|
||||
items: NestedPartial<DirectusComment<Schema>>[],
|
||||
query?: TQuery,
|
||||
): RestCommand<UpdateCommentOutput<Schema, TQuery>[], Schema> =>
|
||||
() => ({
|
||||
path: `/comments`,
|
||||
params: query ?? {},
|
||||
body: JSON.stringify(items),
|
||||
method: 'PATCH',
|
||||
});
|
||||
|
||||
/**
|
||||
* Update an existing comment.
|
||||
* @param key
|
||||
|
||||
Reference in New Issue
Block a user