fix homeassistnat
This commit is contained in:
parent
8b436e1ad5
commit
77c4a7599a
@ -1,8 +1,8 @@
|
||||
import { serve } from "bun";
|
||||
import { Hono } from "hono";
|
||||
import { prettyJSON } from "hono/pretty-json";
|
||||
|
||||
import * as ddb from "../../doorman-api/deprecated-functions/common/ddb.private";
|
||||
import { createDDBClient, getDoorConfigCommand, getLockStatusCommand, isLockOpen } from "../../doorman-api/src/utils/ddb";
|
||||
import { DoorStatus } from "../../doorman-api/src/types/DoorStatus";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
@ -16,17 +16,17 @@ app.get("/api/door/info", async (c) => {
|
||||
}, 400);
|
||||
}
|
||||
|
||||
const client = ddb.createDDBClient(Bun.env);
|
||||
const config = await client.send(ddb.getDoorConfigCommand(door));
|
||||
const client = createDDBClient(Bun.env as any);
|
||||
const config = await client.send(getDoorConfigCommand(door));
|
||||
|
||||
if (!config.Item) {
|
||||
return c.json({
|
||||
err: "This buzzer is not registered properly",
|
||||
}, 404);
|
||||
}
|
||||
return await client.send(ddb.getLockStatusCommand(door))
|
||||
return await client.send(getLockStatusCommand(door))
|
||||
.then(async (lock) => {
|
||||
const status = ddb.isLockOpen(lock) ? "OPEN": "CLOSED";
|
||||
const status = isLockOpen(lock) ? DoorStatus.OPEN: "CLOSED";
|
||||
return c.json({
|
||||
id: door,
|
||||
status,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user