Merge branch 'feature/typescript_backend' into feature/typescript_backend_2

This commit is contained in:
Elian Doran 2024-02-18 20:39:18 +02:00
commit 11c7533984
No known key found for this signature in database
9 changed files with 12 additions and 12 deletions

View File

@ -90,14 +90,14 @@ abstract class AbstractBeccaEntity<T extends AbstractBeccaEntity<T>> {
}
hasStringContent(): boolean {
// FIXME: Not sure why some entities don't implement it.
// TODO: Not sure why some entities don't implement it.
return true;
}
abstract getPojo(): {};
get isDeleted(): boolean {
// FIXME: Not sure why some entities don't implement it.
// TODO: Not sure why some entities don't implement it.
return false;
}

View File

@ -15,7 +15,7 @@ const attachmentRoleToNoteTypeMapping = {
};
interface ContentOpts {
// FIXME: Found in bnote.ts, to check if it's actually used and not a typo.
// TODO: Found in bnote.ts, to check if it's actually used and not a typo.
forceSave?: boolean;
/** will also save this BAttachment entity */
@ -135,7 +135,7 @@ class BAttachment extends AbstractBeccaEntity<BAttachment> {
}
convertToNote(): { note: BNote, branch: BBranch } {
// FIXME: can this ever be "search"?
// TODO: can this ever be "search"?
if (this.type as string === 'search') {
throw new Error(`Note of type search cannot have child notes`);
}

View File

@ -1,6 +1,6 @@
import { BlobRow } from "./rows";
// FIXME: Why this does not extend the abstract becca?
// TODO: Why this does not extend the abstract becca?
class BBlob {
static get entityName() { return "blobs"; }
static get primaryKeyName() { return "blobId"; }

View File

@ -899,7 +899,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
const {searchResultNoteIds} = searchService.searchFromNote(this);
const becca = this.becca;
return (searchResultNoteIds as string[]) // FIXME: remove cast once search is converted
return (searchResultNoteIds as string[]) // TODO: remove cast once search is converted
.map(resultNoteId => becca.notes[resultNoteId])
.filter(note => !!note);
}

View File

@ -88,7 +88,7 @@ class BRevision extends AbstractBeccaEntity<BRevision> {
*
* This is the same approach as is used for Note's content.
*/
// FIXME: initial declaration included Buffer, but everywhere it's treated as a string.
// TODO: initial declaration included Buffer, but everywhere it's treated as a string.
getContent(): string {
return this._getContent() as string;
}

View File

@ -1,4 +1,4 @@
// FIXME: Booleans should probably be numbers instead (as SQLite does not have booleans.);
// TODO: Booleans should probably be numbers instead (as SQLite does not have booleans.);
export interface AttachmentRow {
attachmentId?: string;

View File

@ -31,7 +31,7 @@ function changePassword(currentPassword: string, newPassword: string) {
const newPasswordVerificationKey = utils.toBase64(myScryptService.getVerificationHash(newPassword));
if (decryptedDataKey) {
// FIXME: what should happen if the decrypted data key is null?
// TODO: what should happen if the decrypted data key is null?
passwordEncryptionService.setDataKey(newPassword, decryptedDataKey);
}

View File

@ -6,7 +6,7 @@
const Mutex = require('async-mutex').Mutex;
const instance = new Mutex();
async function doExclusively<T>(func: () => void) {
async function doExclusively<T>(func: () => T) {
const releaseMutex = await instance.acquire();
try {

View File

@ -82,7 +82,7 @@ function unescapeHtml(str: string) {
}
function toObject<T, K extends string | number | symbol, V>(array: T[], fn: (item: T) => [K, V]): Record<K, V> {
const obj: Record<K, V> = {} as Record<K, V>; // FIXME: unsafe?
const obj: Record<K, V> = {} as Record<K, V>; // TODO: unsafe?
for (const item of array) {
const ret = fn(item);
@ -98,7 +98,7 @@ function stripTags(text: string) {
}
function union<T extends string | number | symbol>(a: T[], b: T[]): T[] {
const obj: Record<T, T> = {} as Record<T, T>; // FIXME: unsafe?
const obj: Record<T, T> = {} as Record<T, T>; // TODO: unsafe?
for (let i = a.length-1; i >= 0; i--) {
obj[a[i]] = a[i];