refactor: Use string ids on Credentials, Workflows, Tags, and Executions DB entities (#5041)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-02 17:42:32 +01:00
committed by GitHub
parent 8bee04cd2a
commit ee28213538
83 changed files with 468 additions and 645 deletions

View File

@@ -180,7 +180,7 @@ describe('GET /workflows', () => {
position: [0, 0],
credentials: {
actionNetworkApi: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -220,7 +220,7 @@ describe('GET /workflows', () => {
const [usedCredential] = fetchedWorkflow.usedCredentials;
expect(usedCredential).toMatchObject({
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
type: savedCredential.type,
currentUserHasAccess: true,
@@ -313,7 +313,7 @@ describe('GET /workflows/:id', () => {
const workflowPayload = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const workflow = await createWorkflow(workflowPayload, owner);
@@ -322,7 +322,7 @@ describe('GET /workflows/:id', () => {
expect(response.statusCode).toBe(200);
expect(response.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: true,
},
@@ -338,7 +338,7 @@ describe('GET /workflows/:id', () => {
const workflowPayload = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const workflow = await createWorkflow(workflowPayload, owner);
@@ -347,7 +347,7 @@ describe('GET /workflows/:id', () => {
expect(response.statusCode).toBe(200);
expect(response.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: false, // although owner can see, he does not have access
},
@@ -363,7 +363,7 @@ describe('GET /workflows/:id', () => {
const workflowPayload = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const workflow = await createWorkflow(workflowPayload, member1);
await testDb.shareWorkflowWithUsers(workflow, [member2]);
@@ -372,7 +372,7 @@ describe('GET /workflows/:id', () => {
expect(responseMember1.statusCode).toBe(200);
expect(responseMember1.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: true, // one user has access
},
@@ -383,7 +383,7 @@ describe('GET /workflows/:id', () => {
expect(responseMember2.statusCode).toBe(200);
expect(responseMember2.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: false, // the other one doesn't
},
@@ -400,7 +400,7 @@ describe('GET /workflows/:id', () => {
const workflowPayload = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const workflow = await createWorkflow(workflowPayload, member1);
await testDb.shareWorkflowWithUsers(workflow, [member2]);
@@ -409,7 +409,7 @@ describe('GET /workflows/:id', () => {
expect(responseMember1.statusCode).toBe(200);
expect(responseMember1.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: true,
},
@@ -420,7 +420,7 @@ describe('GET /workflows/:id', () => {
expect(responseMember2.statusCode).toBe(200);
expect(responseMember2.body.data.usedCredentials).toMatchObject([
{
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
currentUserHasAccess: true,
},
@@ -446,7 +446,7 @@ describe('POST /workflows', () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });
const workflow = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const response = await authAgent(owner).post('/workflows').send(workflow);
@@ -462,7 +462,7 @@ describe('POST /workflows', () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });
const workflow = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const response = await authAgent(member).post('/workflows').send(workflow);
@@ -481,7 +481,7 @@ describe('POST /workflows', () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: member });
const workflow = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const response = await authAgent(owner).post('/workflows').send(workflow);
@@ -498,7 +498,7 @@ describe('POST /workflows', () => {
const workflow = makeWorkflow({
withPinData: false,
withCredential: { id: savedCredential.id.toString(), name: savedCredential.name },
withCredential: { id: savedCredential.id, name: savedCredential.name },
});
const response = await authAgent(member2).post('/workflows').send(workflow);
@@ -525,7 +525,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -563,7 +563,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -588,7 +588,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -619,7 +619,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -653,7 +653,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -682,7 +682,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},
@@ -721,7 +721,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
typeVersion: 1,
credentials: {
default: {
id: savedCredential.id.toString(),
id: savedCredential.id,
name: savedCredential.name,
},
},