feat: Add reordering to starred documents (#2953)
* draft * reordering * JIT Index stars on first load * test * Remove unused code on client * small unrefactor
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
User,
|
||||
Event,
|
||||
Document,
|
||||
Star,
|
||||
Collection,
|
||||
Group,
|
||||
GroupUser,
|
||||
@@ -44,6 +45,30 @@ export async function buildShare(overrides: Partial<Share> = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildStar(overrides: Partial<Star> = {}) {
|
||||
let user;
|
||||
|
||||
if (overrides.userId) {
|
||||
user = await User.findByPk(overrides.userId);
|
||||
} else {
|
||||
user = await buildUser();
|
||||
overrides.userId = user.id;
|
||||
}
|
||||
|
||||
if (!overrides.documentId) {
|
||||
const document = await buildDocument({
|
||||
createdById: overrides.userId,
|
||||
teamId: user?.teamId,
|
||||
});
|
||||
overrides.documentId = document.id;
|
||||
}
|
||||
|
||||
return Star.create({
|
||||
index: "h",
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export function buildTeam(overrides: Record<string, any> = {}) {
|
||||
count++;
|
||||
return Team.create(
|
||||
|
||||
Reference in New Issue
Block a user