Skip to content

Commit

Permalink
ok bro
Browse files Browse the repository at this point in the history
  • Loading branch information
dromzeh committed Mar 20, 2024
1 parent 22151a6 commit d547d7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/v2/routes/asset/upload-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { assetTagAsset } from "@/v2/db/schema"
import { createRoute } from "@hono/zod-openapi"
import { GenericResponses } from "@/v2/lib/response-schemas"
import { z } from "@hono/zod-openapi"
import { generateID } from "@/v2/lib/oslo"

const AcceptedImageType = "image/png"
const MaxFileSize = 5 * 1024 * 1024
Expand Down Expand Up @@ -135,14 +136,17 @@ export const UploadAssetRoute = (handler: AppHandler) =>

const { drizzle } = getConnection(ctx.env)

const randomId = generateID()

const { key } = await ctx.env.FILES_BUCKET.put(
`/assets/${gameId}/${assetCategoryId}/${name}.png`,
`/assets/${randomId}.png`,
asset
)

const createdAsset = await drizzle
.insert(asset)
.values({
id: randomId,
name: name,
extension: "png",
gameId: gameId,
Expand Down

0 comments on commit d547d7b

Please sign in to comment.