This commit is contained in:
Adria Navarro 2024-07-11 17:16:14 +02:00
parent 9ff3d8cf77
commit ba2d6fd73b
4 changed files with 14 additions and 18 deletions

View File

@ -65,7 +65,6 @@ export async function update(
ctx.body = {
tableId: table._id!,
...actions,
}
}

View File

@ -95,8 +95,8 @@ describe("/rowsActions", () => {
})
expect(res).toEqual({
id: expect.stringMatching(/^row_action_\w+/),
tableId: tableId,
actionId: expect.stringMatching(/^row_action_\w+/),
...rowAction,
})
@ -105,7 +105,7 @@ describe("/rowsActions", () => {
_rev: expect.stringMatching(/^1-\w+/),
tableId: tableId,
actions: {
[res.actionId]: rowAction,
[res.id]: rowAction,
},
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
@ -123,9 +123,9 @@ describe("/rowsActions", () => {
_id: `ra_${tableId}`,
_rev: expect.stringMatching(/^3-\w+/),
actions: {
[responses[0].actionId]: rowActions[0],
[responses[1].actionId]: rowActions[1],
[responses[2].actionId]: rowActions[2],
[responses[0].id]: rowActions[0],
[responses[1].id]: rowActions[1],
[responses[2].id]: rowActions[2],
},
tableId: tableId,
createdAt: new Date().toISOString(),
@ -166,9 +166,9 @@ describe("/rowsActions", () => {
expect.objectContaining({
tableId,
actions: {
[rowActions[0].actionId]: expect.any(Object),
[rowActions[1].actionId]: expect.any(Object),
[rowActions[2].actionId]: expect.any(Object),
[rowActions[0].id]: expect.any(Object),
[rowActions[1].id]: expect.any(Object),
[rowActions[2].id]: expect.any(Object),
},
})
)
@ -207,8 +207,8 @@ describe("/rowsActions", () => {
})
expect(res).toEqual({
id: actionId,
tableId,
actionId,
...actionData,
name: updatedName,
})
@ -245,7 +245,7 @@ describe("/rowsActions", () => {
const action = await createRowAction(tableId, createRowActionRequest())
await config.api.rowAction.update(
otherTable._id!,
action.actionId,
action.id,
createRowActionRequest(),
{ status: 400 }
)

View File

@ -26,7 +26,7 @@ export async function create(tableId: string, rowAction: { name: string }) {
await db.put(doc)
return {
actionId: newId,
id: newId,
...rowAction,
}
}
@ -62,7 +62,7 @@ export async function update(
await db.put(actionsDoc)
return {
actionId: rowActionId,
id: rowActionId,
...rowAction,
}
}

View File

@ -1,8 +1,8 @@
export interface CreateRowActionRequest extends RowActionData {}
export interface RowActionResponse extends RowActionData {
id: string
tableId: string
actionId: string
}
export interface RowActionsResponse {
@ -14,7 +14,4 @@ interface RowActionData {
name: string
}
export interface UpdateRowActionRequest {
id: string
name: string
}
export interface UpdateRowActionRequest extends RowActionData {}