48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
|
|
import Realm from 'realm'
|
|||
|
|
import path from 'path'
|
|||
|
|
import { BaseService } from '../baseService.js'
|
|||
|
|
import { define } from '../../../define.js'
|
|||
|
|
import { BookTaskModel } from '../../model/Book/bookTask.js'
|
|||
|
|
import { BookTaskStatus } from '../../../enum/bookEnum.js'
|
|||
|
|
import { successMessage } from '../../../../main/generalTools.js'
|
|||
|
|
import { BaseRealmService } from './bookBasic'
|
|||
|
|
const { v4: uuidv4 } = require('uuid')
|
|||
|
|
|
|||
|
|
let dbPath = path.resolve(define.db_path, 'book.realm')
|
|||
|
|
|
|||
|
|
// 版本迁移
|
|||
|
|
const migration = (oldRealm: Realm, newRealm: Realm) => {}
|
|||
|
|
|
|||
|
|
export class BookTaskDetailService extends BaseRealmService {
|
|||
|
|
static instance: BookTaskDetailService | null = null
|
|||
|
|
realm: Realm
|
|||
|
|
|
|||
|
|
private constructor() {
|
|||
|
|
super()
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取当前实例对象,为空则创建一个新的
|
|||
|
|
* @returns
|
|||
|
|
*/
|
|||
|
|
public static async getInstance() {
|
|||
|
|
if (BookTaskDetailService.instance === null) {
|
|||
|
|
BookTaskDetailService.instance = new BookTaskDetailService()
|
|||
|
|
await super.getInstance()
|
|||
|
|
}
|
|||
|
|
return BookTaskDetailService.instance
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 添加一条小说人物对应的详细数据
|
|||
|
|
* @param BookTaskDetail
|
|||
|
|
*/
|
|||
|
|
public async AddBookTaskDetail(BookTaskDetail) {
|
|||
|
|
try {
|
|||
|
|
// 判断是不是又小说的ID
|
|||
|
|
} catch (error) {
|
|||
|
|
throw error
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|