fix: 对接

This commit is contained in:
ikechan8370 2025-03-16 22:13:52 +08:00
parent 89ab58b3d7
commit eee1285e2f
11 changed files with 221 additions and 26 deletions

View file

@ -1,4 +1,4 @@
import { ChaiteStorage } from 'chaite'
import { ChaiteStorage, Channel } from 'chaite'
export class LowDBChannelStorage extends ChaiteStorage {
/**
@ -21,7 +21,8 @@ export class LowDBChannelStorage extends ChaiteStorage {
* @returns {Promise<import('chaite').Channel>}
*/
async getItem (key) {
return this.collection.findOne({ id: key })
const obj = await this.collection.findOne({ id: key })
return new Channel({}).fromString(JSON.stringify(obj))
}
/**
@ -53,7 +54,8 @@ export class LowDBChannelStorage extends ChaiteStorage {
* @returns {Promise<import('chaite').Channel[]>}
*/
async listItems () {
return this.collection.findAll()
const list = await this.collection.findAll()
return list.map(item => new Channel({}).fromString(JSON.stringify(item)))
}
async clear () {