TS fixes
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { FastifyInstance } from "fastify";
|
import { FastifyInstance } from "fastify";
|
||||||
import {createInvoicePDF, createTimeSheetPDF} from "../utils/pdf";
|
import {createInvoicePDF, createTimeSheetPDF} from "../utils/pdf";
|
||||||
import {encodeBase64ToNiimbot, generateLabel, useNextNumberRangeNumber} from "../utils/functions";
|
//import {encodeBase64ToNiimbot, generateLabel, useNextNumberRangeNumber} from "../utils/functions";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { ready as zplReady } from 'zpl-renderer-js'
|
//import { ready as zplReady } from 'zpl-renderer-js'
|
||||||
import { renderZPL } from "zpl-image";
|
//import { renderZPL } from "zpl-image";
|
||||||
|
|
||||||
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
||||||
import isoWeek from "dayjs/plugin/isoWeek.js";
|
import isoWeek from "dayjs/plugin/isoWeek.js";
|
||||||
@@ -155,7 +155,7 @@ export default async function functionRoutes(server: FastifyInstance) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
server.post('/print/zpl/preview', async (req, reply) => {
|
/*server.post('/print/zpl/preview', async (req, reply) => {
|
||||||
const { zpl, widthMm = 50, heightMm = 30, dpmm = 8, asBase64 = false } = req.body as {zpl:string,widthMm:number,heightMm:number,dpmm:number,asBase64:string}
|
const { zpl, widthMm = 50, heightMm = 30, dpmm = 8, asBase64 = false } = req.body as {zpl:string,widthMm:number,heightMm:number,dpmm:number,asBase64:string}
|
||||||
|
|
||||||
console.log(widthMm,heightMm,dpmm)
|
console.log(widthMm,heightMm,dpmm)
|
||||||
@@ -192,6 +192,6 @@ export default async function functionRoutes(server: FastifyInstance) {
|
|||||||
console.error('[ZPL Preview Error]', err)
|
console.error('[ZPL Preview Error]', err)
|
||||||
return reply.code(500).send({ error: err.message || 'Failed to render ZPL' })
|
return reply.code(500).send({ error: err.message || 'Failed to render ZPL' })
|
||||||
}
|
}
|
||||||
})
|
})*/
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ export default async function staffTimeRoutes(server: FastifyInstance) {
|
|||||||
server.post(
|
server.post(
|
||||||
'/staff/time',
|
'/staff/time',
|
||||||
async (req, reply) => {
|
async (req, reply) => {
|
||||||
const { started_at, stopped_at, type = 'work', description, user_id } = req.body
|
const { started_at, stopped_at, type = 'work', description, user_id } = req.body as any
|
||||||
const userId = req.user.user_id
|
const userId = req.user.user_id
|
||||||
const tenantId = req.user.tenant_id
|
const tenantId = req.user.tenant_id
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {FastifyInstance} from "fastify";
|
import {FastifyInstance} from "fastify";
|
||||||
import { PNG } from 'pngjs'
|
// import { PNG } from 'pngjs'
|
||||||
import { ready as zplReady } from 'zpl-renderer-js'
|
// import { ready as zplReady } from 'zpl-renderer-js'
|
||||||
import { Utils } from '@mmote/niimbluelib'
|
// import { Utils } from '@mmote/niimbluelib'
|
||||||
import { createCanvas } from 'canvas'
|
// import { createCanvas } from 'canvas'
|
||||||
import bwipjs from 'bwip-js'
|
// import bwipjs from 'bwip-js'
|
||||||
import Sharp from 'sharp'
|
// import Sharp from 'sharp'
|
||||||
import fs from 'fs'
|
// import fs from 'fs'
|
||||||
|
|
||||||
export const useNextNumberRangeNumber = async (server:FastifyInstance, tenantId:number,numberRange)=> {
|
export const useNextNumberRangeNumber = async (server:FastifyInstance, tenantId:number,numberRange)=> {
|
||||||
const {data:tenant} = await server.supabase.from("tenants").select().eq("id",tenantId).single()
|
const {data:tenant} = await server.supabase.from("tenants").select().eq("id",tenantId).single()
|
||||||
@@ -29,6 +29,7 @@ export const useNextNumberRangeNumber = async (server:FastifyInstance, tenantId:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
export async function encodeBase64ToNiimbot(base64Png, printDirection = 'top') {
|
export async function encodeBase64ToNiimbot(base64Png, printDirection = 'top') {
|
||||||
// 1️⃣ PNG dekodieren
|
// 1️⃣ PNG dekodieren
|
||||||
const buffer = Buffer.from(base64Png, 'base64')
|
const buffer = Buffer.from(base64Png, 'base64')
|
||||||
@@ -140,4 +141,4 @@ export async function generateLabel(context,width,height) {
|
|||||||
const base64 = final.toString('base64')
|
const base64 = final.toString('base64')
|
||||||
|
|
||||||
return base64
|
return base64
|
||||||
}
|
}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user