This PR migrates `noteTarget` and `taskTarget` to morph relations behind separate feature flags, following the Attachment/TimelineActivity pattern. It introduces the `IS_NOTE_TARGET_MIGRATED` and `IS_TASK_TARGET_MIGRATED` flags, updates standard field metadata and indexes to use morph relations, and adds two **1.17 workspace migrations** that: - rename `noteTarget.*Id` / `taskTarget.*Id` columns to `target*Id` - convert the corresponding field metadata to `MORPH_RELATION` with a shared `morphId` On the frontend, note/task target read and write paths switch to `target*Id` when the respective flag is enabled. Deleted targets are filtered on reload to prevent reappearing relations.
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import request from 'supertest';
|
|
|
|
const client = request(`http://localhost:${APP_PORT}`);
|
|
|
|
describe('taskTargetsResolver (e2e)', () => {
|
|
it('should find many taskTargets', () => {
|
|
const queryData = {
|
|
query: `
|
|
query taskTargets {
|
|
taskTargets {
|
|
edges {
|
|
node {
|
|
id
|
|
createdAt
|
|
updatedAt
|
|
deletedAt
|
|
taskId
|
|
targetPersonId
|
|
targetCompanyId
|
|
targetOpportunityId
|
|
targetPetId
|
|
targetSurveyResultId
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`,
|
|
};
|
|
|
|
return client
|
|
.post('/graphql')
|
|
.set('Authorization', `Bearer ${APPLE_JANE_ADMIN_ACCESS_TOKEN}`)
|
|
.send(queryData)
|
|
.expect(200)
|
|
.expect((res) => {
|
|
expect(res.body.data).toBeDefined();
|
|
expect(res.body.errors).toBeUndefined();
|
|
})
|
|
.expect((res) => {
|
|
const data = res.body.data.taskTargets;
|
|
|
|
expect(data).toBeDefined();
|
|
expect(Array.isArray(data.edges)).toBe(true);
|
|
|
|
const edges = data.edges;
|
|
|
|
if (edges.length > 0) {
|
|
const taskTargets = edges[0].node;
|
|
|
|
expect(taskTargets).toHaveProperty('id');
|
|
expect(taskTargets).toHaveProperty('createdAt');
|
|
expect(taskTargets).toHaveProperty('updatedAt');
|
|
expect(taskTargets).toHaveProperty('deletedAt');
|
|
expect(taskTargets).toHaveProperty('taskId');
|
|
expect(taskTargets).toHaveProperty('targetPersonId');
|
|
expect(taskTargets).toHaveProperty('targetCompanyId');
|
|
expect(taskTargets).toHaveProperty('targetOpportunityId');
|
|
expect(taskTargets).toHaveProperty('targetPetId');
|
|
expect(taskTargets).toHaveProperty('targetSurveyResultId');
|
|
}
|
|
});
|
|
});
|
|
});
|