Check names properly

This commit is contained in:
Adria Navarro 2024-10-23 13:15:07 +02:00
parent b4a979ed97
commit 1fef7838f2
2 changed files with 7 additions and 5 deletions

View File

@ -23,7 +23,8 @@ async function ensureUniqueAndThrow(
if (
Object.entries(names).find(
([id, name]) => name === name && id !== existingRowActionId
([automationId, automationName]) =>
automationName === name && automationId !== existingRowActionId
)
) {
throw new HTTPError("A row action with the same name already exists.", 409)

View File

@ -1,5 +1,6 @@
import {
CreateRowActionRequest,
RowActionPermissionsResponse,
RowActionResponse,
RowActionsResponse,
RowActionTriggerRequest,
@ -78,7 +79,7 @@ export class RowActionAPI extends TestAPI {
expectations?: Expectations,
config?: { publicUser?: boolean }
) => {
return await this._post<RowActionResponse>(
return await this._post<RowActionPermissionsResponse>(
`/api/tables/${tableId}/actions/${rowActionId}/permissions`,
{
expectations: {
@ -96,7 +97,7 @@ export class RowActionAPI extends TestAPI {
expectations?: Expectations,
config?: { publicUser?: boolean }
) => {
return await this._delete<RowActionResponse>(
return await this._delete<RowActionPermissionsResponse>(
`/api/tables/${tableId}/actions/${rowActionId}/permissions`,
{
expectations: {
@ -115,7 +116,7 @@ export class RowActionAPI extends TestAPI {
expectations?: Expectations,
config?: { publicUser?: boolean }
) => {
return await this._post<RowActionResponse>(
return await this._post<RowActionPermissionsResponse>(
`/api/tables/${tableId}/actions/${rowActionId}/permissions/${viewId}`,
{
expectations: {
@ -134,7 +135,7 @@ export class RowActionAPI extends TestAPI {
expectations?: Expectations,
config?: { publicUser?: boolean }
) => {
return await this._delete<RowActionResponse>(
return await this._delete<RowActionPermissionsResponse>(
`/api/tables/${tableId}/actions/${rowActionId}/permissions/${viewId}`,
{
expectations: {