deliver Hongfa Laundry M1 desktop release
This commit is contained in:
18
src/main/ipc/photos.ts
Normal file
18
src/main/ipc/photos.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { SavePhotoSchema } from "../../shared/schemas";
|
||||
import { getDb, schema } from "../db";
|
||||
import { PhotoService } from "../services/photoService";
|
||||
import { registerIpcHandler } from "./helpers";
|
||||
|
||||
export function registerPhotoIpc(): void {
|
||||
registerIpcHandler("photos:save", SavePhotoSchema, (input) => {
|
||||
const fileName = PhotoService.savePhoto(input.orderId, input.base64Data);
|
||||
return getDb()
|
||||
.insert(schema.orderPhotos)
|
||||
.values({
|
||||
orderId: input.orderId,
|
||||
filePath: fileName,
|
||||
})
|
||||
.returning()
|
||||
.get();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user