Sprite manager front- and backend logics
This commit is contained in:
parent
a0fe0760b0
commit
19234b1f6e
@ -1,10 +1,18 @@
|
|||||||
import { Server } from 'socket.io'
|
import { Server } from 'socket.io'
|
||||||
import { TSocket } from '../../../utilities/Types'
|
import { TSocket } from '../../../utilities/Types'
|
||||||
import prisma from '../../../utilities/Prisma'
|
import prisma from '../../../utilities/Prisma'
|
||||||
|
import type { SpriteImage } from '@prisma/client'
|
||||||
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
type uploadSpriteImage = SpriteImage & {
|
||||||
|
base64: string
|
||||||
|
}
|
||||||
|
|
||||||
type Payload = {
|
type Payload = {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
|
spriteImages: uploadSpriteImage[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,10 +32,18 @@ export default function (socket: TSocket, io: Server) {
|
|||||||
id: data.id
|
id: data.id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
name: data.name
|
name: data.name,
|
||||||
|
spriteImages: {
|
||||||
|
deleteMany: {
|
||||||
|
spriteId: data.id
|
||||||
|
},
|
||||||
|
create: data.spriteImages
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// store the sprite image
|
||||||
|
|
||||||
callback(true)
|
callback(true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user