Removed openticket -> opendiscord migration utils
This commit is contained in:
@@ -7,30 +7,6 @@ import nodepath from "path"
|
|||||||
import { ODDebugger } from "./console"
|
import { ODDebugger } from "./console"
|
||||||
import * as fjs from "formatted-json-stringify"
|
import * as fjs from "formatted-json-stringify"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
|
||||||
//TEMPORARY OPENTICKET => OPENDISCORD MIGRATION UTILITIES
|
|
||||||
/////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/** ## ❌ Temporary function. Will be removed on full OTv4 release! */
|
|
||||||
export function TEMP_migrateDatabaseIdPrefix(id:string): string {
|
|
||||||
if (!id.startsWith("openticket:")) return id
|
|
||||||
return id.replaceAll("openticket:","opendiscord:")
|
|
||||||
}
|
|
||||||
/** ## ❌ Temporary function. Will be removed on full OTv4 release! */
|
|
||||||
export function TEMP_migrateDatabaseValuePrefix(value:string): string {
|
|
||||||
return value.replaceAll('"openticket:','"opendiscord:')
|
|
||||||
}
|
|
||||||
/** ## ❌ Temporary function. Will be removed on full OTv4 release! */
|
|
||||||
export function TEMP_migrateDatabaseStructurePrefix(structure:ODJsonDatabaseStructure): ODJsonDatabaseStructure {
|
|
||||||
return structure.map((data) => {
|
|
||||||
return {
|
|
||||||
category:TEMP_migrateDatabaseIdPrefix(data.category),
|
|
||||||
key:TEMP_migrateDatabaseIdPrefix(data.key),
|
|
||||||
value:JSON.parse(TEMP_migrateDatabaseValuePrefix(JSON.stringify(data.value)))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**## ODDatabaseManager `class`
|
/**## ODDatabaseManager `class`
|
||||||
* This is an Open Ticket database manager.
|
* This is an Open Ticket database manager.
|
||||||
*
|
*
|
||||||
@@ -118,10 +94,7 @@ export class ODJsonDatabase extends ODDatabase {
|
|||||||
|
|
||||||
/**Init the database. */
|
/**Init the database. */
|
||||||
init(): ODPromiseVoid {
|
init(): ODPromiseVoid {
|
||||||
//this.#system.getData()
|
this.#system.getData()
|
||||||
//TEMPORARY!!!
|
|
||||||
const newData = TEMP_migrateDatabaseStructurePrefix(this.#system.getData())
|
|
||||||
this.#system.setData(newData)
|
|
||||||
}
|
}
|
||||||
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
||||||
* @example
|
* @example
|
||||||
@@ -226,10 +199,7 @@ export class ODFormattedJsonDatabase extends ODDatabase {
|
|||||||
|
|
||||||
/**Init the database. */
|
/**Init the database. */
|
||||||
init(): ODPromiseVoid {
|
init(): ODPromiseVoid {
|
||||||
//this.#system.getData()
|
this.#system.getData()
|
||||||
//TEMPORARY!!!
|
|
||||||
const newData = TEMP_migrateDatabaseStructurePrefix(this.#system.getData())
|
|
||||||
this.#system.setData(newData)
|
|
||||||
}
|
}
|
||||||
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
/**Set/overwrite the value of `category` & `key`. Returns `true` when overwritten!
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
Reference in New Issue
Block a user