Skip to content

Commit

Permalink
wip: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
raska-vilem committed Jan 26, 2025
1 parent f313cf0 commit 675e65d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions GAPP/apps/gapp-server/src/controllers/sondes.controller.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { FastifyPluginAsyncTypebox } from '@fastify/type-provider-typebox';
import { B_SondeTelemetry } from '../schemas';
import { B_SondeTtnTelemetry } from '../schemas';
import { ttnPacketDto } from '../utils/ttn-packet-dto';

export const sondesController: FastifyPluginAsyncTypebox = async (fastify) => {
fastify.post(
'/telemetry',
'/ttn',
{
schema: {
summary: 'TTN webhook',
description: 'Endpoint for receiving telemetry data from TTN',
body: B_SondeTelemetry,
body: B_SondeTtnTelemetry,
},
},
async (req, rep) => {
Expand Down
2 changes: 1 addition & 1 deletion GAPP/apps/gapp-server/src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const B_CarStatus = T.Object({
});
export type CarStatus = Static<typeof B_CarStatus>;

export const B_SondeTelemetry = T.Object({
export const B_SondeTtnTelemetry = T.Object({
end_device_ids: T.Object({
device_id: T.String(),
}),
Expand Down
4 changes: 2 additions & 2 deletions GAPP/apps/gapp-server/src/utils/ttn-packet-dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Static } from '@sinclair/typebox';
import { B_SondeTelemetry } from '../schemas';
import { B_SondeTtnTelemetry } from '../schemas';
import { TelemetryPacket } from '@gapp/sondehub';

export const ttnPacketDto = (ttnPayload: Static<typeof B_SondeTelemetry>): TelemetryPacket => {
export const ttnPacketDto = (ttnPayload: Static<typeof B_SondeTtnTelemetry>): TelemetryPacket => {
return {
time_received: ttnPayload.uplink_message.received_at,
payload_callsign: ttnPayload.end_device_ids.device_id,
Expand Down

0 comments on commit 675e65d

Please sign in to comment.