mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-22 11:43:34 +03:00
Remove check unique position (#5760)
Currently position can be the same for records displayed in a board view. Removing unicity check until we find a new startegy.
This commit is contained in:
parent
9f6a6c3282
commit
9567103d5f
@ -46,25 +46,18 @@ describe('RecordPositionFactory', () => {
|
||||
it('should return the value when value is a number', async () => {
|
||||
const value = 1;
|
||||
|
||||
workspaceDataSourceService.executeRawQuery.mockResolvedValue([]);
|
||||
|
||||
const result = await factory.create(value, objectMetadata, workspaceId);
|
||||
|
||||
expect(result).toEqual(value);
|
||||
});
|
||||
it('should throw an error when position is not unique', async () => {
|
||||
const value = 1;
|
||||
|
||||
await expect(
|
||||
factory.create(value, objectMetadata, workspaceId),
|
||||
).rejects.toThrow('Position is not unique');
|
||||
});
|
||||
it('should return the existing position -1 when value is first', async () => {
|
||||
const value = 'first';
|
||||
const result = await factory.create(value, objectMetadata, workspaceId);
|
||||
|
||||
expect(result).toEqual(0);
|
||||
});
|
||||
|
||||
it('should return the existing position + 1 when value is last', async () => {
|
||||
const value = 'last';
|
||||
const result = await factory.create(value, objectMetadata, workspaceId);
|
||||
|
@ -26,20 +26,6 @@ export class RecordPositionFactory {
|
||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
||||
|
||||
if (typeof value === 'number') {
|
||||
const recordWithSamePosition = await this.findRecordPosition(
|
||||
{
|
||||
recordPositionQueryType: RecordPositionQueryType.FIND_BY_POSITION,
|
||||
positionValue: value,
|
||||
},
|
||||
objectMetadata,
|
||||
dataSourceSchema,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (recordWithSamePosition) {
|
||||
throw new Error('Position is not unique');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user