Fix more import/export tests for backups
This commit is contained in:
parent
8dabe4fbe4
commit
84c562d0b2
13 changed files with 225 additions and 60 deletions
|
@ -875,6 +875,7 @@ type WritableInterface = {
|
|||
) => void;
|
||||
|
||||
createOrUpdateStickerPack: (pack: StickerPackType) => void;
|
||||
createOrUpdateStickerPacks: (packs: ReadonlyArray<StickerPackType>) => void;
|
||||
updateStickerPackStatus: (
|
||||
id: string,
|
||||
status: StickerPackStatusType,
|
||||
|
@ -895,6 +896,9 @@ type WritableInterface = {
|
|||
) => ReadonlyArray<string> | undefined;
|
||||
deleteStickerPack: (packId: string) => Array<string>;
|
||||
addUninstalledStickerPack: (pack: UninstalledStickerPackType) => void;
|
||||
addUninstalledStickerPacks: (
|
||||
pack: ReadonlyArray<UninstalledStickerPackType>
|
||||
) => void;
|
||||
removeUninstalledStickerPack: (packId: string) => void;
|
||||
installStickerPack: (packId: string, timestamp: number) => void;
|
||||
uninstallStickerPack: (packId: string, timestamp: number) => void;
|
||||
|
|
|
@ -486,6 +486,7 @@ export const DataWriter: ServerWritableInterface = {
|
|||
saveBackupCdnObjectMetadata,
|
||||
|
||||
createOrUpdateStickerPack,
|
||||
createOrUpdateStickerPacks,
|
||||
updateStickerPackStatus,
|
||||
updateStickerPackInfo,
|
||||
createOrUpdateSticker,
|
||||
|
@ -495,6 +496,7 @@ export const DataWriter: ServerWritableInterface = {
|
|||
deleteStickerPackReference,
|
||||
deleteStickerPack,
|
||||
addUninstalledStickerPack,
|
||||
addUninstalledStickerPacks,
|
||||
removeUninstalledStickerPack,
|
||||
installStickerPack,
|
||||
uninstallStickerPack,
|
||||
|
@ -5236,6 +5238,16 @@ function createOrUpdateStickerPack(
|
|||
`
|
||||
).run(payload);
|
||||
}
|
||||
function createOrUpdateStickerPacks(
|
||||
db: WritableDB,
|
||||
packs: ReadonlyArray<StickerPackType>
|
||||
): void {
|
||||
db.transaction(() => {
|
||||
for (const pack of packs) {
|
||||
createOrUpdateStickerPack(db, pack);
|
||||
}
|
||||
})();
|
||||
}
|
||||
function updateStickerPackStatus(
|
||||
db: WritableDB,
|
||||
id: string,
|
||||
|
@ -5630,6 +5642,16 @@ function addUninstalledStickerPack(
|
|||
storageNeedsSync: pack.storageNeedsSync ? 1 : 0,
|
||||
});
|
||||
}
|
||||
function addUninstalledStickerPacks(
|
||||
db: WritableDB,
|
||||
packs: ReadonlyArray<UninstalledStickerPackType>
|
||||
): void {
|
||||
return db.transaction(() => {
|
||||
for (const pack of packs) {
|
||||
addUninstalledStickerPack(db, pack);
|
||||
}
|
||||
})();
|
||||
}
|
||||
function removeUninstalledStickerPack(db: WritableDB, packId: string): void {
|
||||
db.prepare<Query>(
|
||||
'DELETE FROM uninstalled_sticker_packs WHERE id IS $id'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue