fix: Cannot create collection if all collections deleted
This commit is contained in:
parent
56c4acc18f
commit
7891a8ee8b
@ -74,7 +74,10 @@ router.post("collections.create", auth(), async (ctx) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
index = fractionalIndex(null, collections[0].index);
|
index = fractionalIndex(
|
||||||
|
null,
|
||||||
|
collections.length ? collections[0].index : null
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
index = await removeIndexCollision(user.teamId, index);
|
index = await removeIndexCollision(user.teamId, index);
|
||||||
|
@ -1002,7 +1002,7 @@ describe("#collections.create", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should create collection", async () => {
|
it("should create collection", async () => {
|
||||||
const { user } = await seed();
|
const user = await buildUser();
|
||||||
const res = await server.post("/api/collections.create", {
|
const res = await server.post("/api/collections.create", {
|
||||||
body: { token: user.getJwtToken(), name: "Test" },
|
body: { token: user.getJwtToken(), name: "Test" },
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user