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:
Thomas Trompette 2024-06-06 11:00:46 +02:00 committed by GitHub
parent 9f6a6c3282
commit 9567103d5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 22 deletions

View File

@ -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);

View File

@ -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;
}