mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
refactor: more consistent naming for object handler
This commit is contained in:
@ -4,7 +4,7 @@ This is used as a utility in metadata handling, so we only fetch the objects if
|
||||
*/
|
||||
import { Readable } from "stream";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { GlobalObjectHandler } from "~/server/plugins/objects";
|
||||
import { objectHandler } from "~/server/plugins/objects";
|
||||
|
||||
type TransactionDataType = string | Readable | Buffer;
|
||||
type TransactionTable = { [key: string]: TransactionDataType }; // ID to data
|
||||
@ -34,7 +34,7 @@ export class ObjectTransactionalHandler {
|
||||
|
||||
const pull = async () => {
|
||||
for (const [id, data] of Object.entries(this.record[transactionId])) {
|
||||
await GlobalObjectHandler.createFromSource(
|
||||
await objectHandler.createFromSource(
|
||||
id,
|
||||
() => {
|
||||
if (typeof data === "string") {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { FsObjectBackend } from "../internal/objects/fsBackend";
|
||||
|
||||
// To-do insert logic surrounding deciding what object backend to use
|
||||
export const GlobalObjectHandler = new FsObjectBackend();
|
||||
export const objectHandler = new FsObjectBackend();
|
||||
|
||||
export default defineNitroPlugin((nitro) => {
|
||||
nitro.hooks.hook("request", (h3) => {
|
||||
h3.context.objects = GlobalObjectHandler;
|
||||
h3.context.objects = objectHandler;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user