fix: 很多功能

This commit is contained in:
ikechan8370 2025-03-20 22:43:39 +08:00
parent a711ec13d7
commit 66905640e4
15 changed files with 242 additions and 29 deletions

View file

@ -25,7 +25,10 @@ export class LowDBProcessorsStorage extends ChaiteStorage {
*/
async getItem (key) {
const obj = await this.collection.findOne({ id: key })
return new ProcessorDTO({}).fromString(JSON.stringify(obj))
if (!obj) {
return null
}
return new ProcessorDTO(obj)
}
/**
@ -35,7 +38,7 @@ export class LowDBProcessorsStorage extends ChaiteStorage {
* @returns {Promise<string>}
*/
async setItem (id, processor) {
if (id) {
if (id && await this.getItem(id)) {
await this.collection.updateById(id, processor)
return id
}