2060 create a new api key (#2206)
* Add folder for api settings * Init create api key page * Update create api key page * Implement api call to create apiKey * Add create api key mutation * Get id when creating apiKey * Display created Api Key * Add delete api key button * Remove button from InputText * Update stuff * Add test for ApiDetail * Fix type * Use recoil instead of router state * Remane route paths * Remove online return * Move and test date util * Remove useless Component * Rename ApiKeys paths * Rename ApiKeys files * Add input text info testing * Rename hooks to webhooks * Remove console error * Add tests to reach minimum coverage
This commit is contained in:
@ -20,7 +20,7 @@ export default {
|
||||
label: 'Api Key',
|
||||
type: 'string',
|
||||
helpText:
|
||||
'Create the api key in [your twenty workspace](https://app.twenty.com/settings/apis)',
|
||||
'Create the api-keys key in [your twenty workspace](https://app.twenty.com/settings/developers/api-keys)',
|
||||
},
|
||||
],
|
||||
connectionLabel: '{{data.currentWorkspace.displayName}}',
|
||||
|
||||
@ -19,12 +19,12 @@ describe('triggers.company', () => {
|
||||
requestDb(
|
||||
z,
|
||||
bundle,
|
||||
`query findManyHook {findManyHook(where: {id: {equals: "${result.id}"}}){id operation}}`,
|
||||
`query findManyWebHook {findManyWebHook(where: {id: {equals: "${result.id}"}}){id operation}}`,
|
||||
),
|
||||
bundle,
|
||||
);
|
||||
expect(checkDbResult.data.findManyHook.length).toEqual(1);
|
||||
expect(checkDbResult.data.findManyHook[0].operation).toEqual(
|
||||
expect(checkDbResult.data.findManyWebHook.length).toEqual(1);
|
||||
expect(checkDbResult.data.findManyWebHook[0].operation).toEqual(
|
||||
'createOneCompany',
|
||||
);
|
||||
});
|
||||
@ -48,13 +48,13 @@ describe('triggers.company', () => {
|
||||
requestDb(
|
||||
z,
|
||||
bundle,
|
||||
`query findManyHook {findManyHook(where: {id: {equals: "${result.id}"}}){id}}`,
|
||||
`query findManyWebHook {findManyWebHook(where: {id: {equals: "${result.id}"}}){id}}`,
|
||||
),
|
||||
bundle,
|
||||
);
|
||||
expect(checkDbResult.data.findManyHook.length).toEqual(0);
|
||||
expect(checkDbResult.data.findManyWebHook.length).toEqual(0);
|
||||
});
|
||||
test('should load company from hook', async () => {
|
||||
test('should load company from web-hook', async () => {
|
||||
const bundle = {
|
||||
cleanedRequest: {
|
||||
id: 'd6ccb1d1-a90b-4822-a992-a0dd946592c9',
|
||||
|
||||
@ -7,22 +7,22 @@ const performSubscribe = async (z: ZObject, bundle: Bundle) => {
|
||||
const result = await requestDb(
|
||||
z,
|
||||
bundle,
|
||||
`mutation createOneHook {createOneHook(data:{${handleQueryParams(
|
||||
`mutation createOneWebHook {createOneWebHook(data:{${handleQueryParams(
|
||||
data,
|
||||
)}}) {id}}`,
|
||||
);
|
||||
return result.data.createOneHook;
|
||||
return result.data.createOneWebHook;
|
||||
};
|
||||
const performUnsubscribe = async (z: ZObject, bundle: Bundle) => {
|
||||
const data = { id: bundle.subscribeData?.id };
|
||||
const result = await requestDb(
|
||||
z,
|
||||
bundle,
|
||||
`mutation deleteOneHook {deleteOneHook(where:{${handleQueryParams(
|
||||
`mutation deleteOneWebHook {deleteOneWebHook(where:{${handleQueryParams(
|
||||
data,
|
||||
)}}) {id}}`,
|
||||
);
|
||||
return result.data.deleteOneHook;
|
||||
return result.data.deleteOneWebHook;
|
||||
};
|
||||
const perform = (z: ZObject, bundle: Bundle) => {
|
||||
return [bundle.cleanedRequest];
|
||||
@ -55,7 +55,7 @@ export default {
|
||||
},
|
||||
operation: {
|
||||
inputFields: [],
|
||||
type: 'hook',
|
||||
type: 'web-hook',
|
||||
performSubscribe,
|
||||
performUnsubscribe,
|
||||
perform,
|
||||
|
||||
Reference in New Issue
Block a user