Skip to content

Commit

Permalink
Add havs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjackhughes committed Oct 7, 2024
1 parent cc70f75 commit 9501248
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ model hav_events {
duration Int
createdAt DateTime @default(now())
updatedAt DateTime
userId String?
}

enum EventType {
Expand Down
2 changes: 2 additions & 0 deletions src/app/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const insertEvent = async (
timestamp: usableEvent.eventDate,
deviceId: wearable.id,
organizationId: wearable.organizationId,
userId: wearable.userId || null,
imuLevel: translateImuLeveltoDBSchema(usableEvent.imuLevel),
duration: usableEvent.duration,
createdAt: new Date(),
Expand Down Expand Up @@ -259,6 +260,7 @@ export const addHavEvents = async ({
eventType: "HandArmVibration" as EventType,
deviceId: deviceId,
organizationId: organisationId,
userId: hav.userId,
duration: hav.duration,
severity: 0,
createdAt: new Date(),
Expand Down
1 change: 1 addition & 0 deletions src/utils/havs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface HavStub {
imu_level: ImuLevel;
created_at: Date;
duration: number;
userId?: string;
}

export function processHavs(havs: HavStub[]): HavStub[] {
Expand Down

0 comments on commit 9501248

Please sign in to comment.