mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 17:59:05 +01:00
refactor
This commit is contained in:
parent
c36b7014a7
commit
09c705fe18
@ -46,18 +46,18 @@ export async function exportNotes(job: Bull.Job<DbUserJobData>, done: any): Prom
|
|||||||
});
|
});
|
||||||
|
|
||||||
let exportedNotesCount = 0;
|
let exportedNotesCount = 0;
|
||||||
let cursor: any = null;
|
let cursor: Note['id'] | null = null;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const notes = await Notes.find({
|
const notes = await Notes.find({
|
||||||
where: {
|
where: {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||||
},
|
},
|
||||||
take: 100,
|
take: 100,
|
||||||
order: {
|
order: {
|
||||||
id: 1
|
id: 1,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (notes.length === 0) {
|
if (notes.length === 0) {
|
||||||
@ -115,7 +115,7 @@ export async function exportNotes(job: Bull.Job<DbUserJobData>, done: any): Prom
|
|||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
function serialize(note: Note, poll: Poll | null = null): any {
|
function serialize(note: Note, poll: Poll | null = null): Record<string, unknown> {
|
||||||
return {
|
return {
|
||||||
id: note.id,
|
id: note.id,
|
||||||
text: note.text,
|
text: note.text,
|
||||||
@ -128,6 +128,6 @@ function serialize(note: Note, poll: Poll | null = null): any {
|
|||||||
viaMobile: note.viaMobile,
|
viaMobile: note.viaMobile,
|
||||||
visibility: note.visibility,
|
visibility: note.visibility,
|
||||||
visibleUserIds: note.visibleUserIds,
|
visibleUserIds: note.visibleUserIds,
|
||||||
localOnly: note.localOnly
|
localOnly: note.localOnly,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user