|
1 |
| -import { PrismaClient } from '@prisma/client' |
2 |
| - |
3 |
| -const prisma = new PrismaClient() |
4 |
| - |
5 |
| -// Define the types/interfaces |
6 |
| -interface Coords { |
7 |
| - accuracy: number |
8 |
| - altitude: number |
9 |
| - altitudeAccuracy: number |
10 |
| - heading: number |
11 |
| - latitude: number |
12 |
| - longitude: number |
13 |
| - speed: number |
14 |
| -} |
15 |
| - |
16 |
| -interface LocationData { |
17 |
| - coords: Coords |
18 |
| - mocked: boolean |
19 |
| - timestamp: number // Use number to match the BigInt-like behavior in JS |
20 |
| -} |
21 |
| - |
22 |
| -interface GeoAddressData { |
23 |
| - city: string | null |
24 |
| - country: string | null |
25 |
| - district: string | null |
26 |
| - formattedAddress: string | null |
27 |
| - isoCountryCode: string | null |
28 |
| - name: string | null |
29 |
| - postalCode: string | null |
30 |
| - region: string | null |
31 |
| - street: string | null |
32 |
| - streetNumber: string | null |
33 |
| - subregion: string | null |
34 |
| - timezone: string | null |
35 |
| -} |
| 1 | +import prisma from './db' |
36 | 2 |
|
37 | 3 | // Function definition with types
|
38 | 4 | async function createLocation(
|
@@ -135,3 +101,35 @@ createLocation(subscriptionId, locationData, geoAddressData)
|
135 | 101 | .finally(async () => {
|
136 | 102 | await prisma.$disconnect()
|
137 | 103 | })
|
| 104 | + |
| 105 | +// Define the types/interfaces |
| 106 | +interface Coords { |
| 107 | + accuracy: number |
| 108 | + altitude: number |
| 109 | + altitudeAccuracy: number |
| 110 | + heading: number |
| 111 | + latitude: number |
| 112 | + longitude: number |
| 113 | + speed: number |
| 114 | +} |
| 115 | + |
| 116 | +interface LocationData { |
| 117 | + coords: Coords |
| 118 | + mocked: boolean |
| 119 | + timestamp: number // Use number to match the BigInt-like behavior in JS |
| 120 | +} |
| 121 | + |
| 122 | +interface GeoAddressData { |
| 123 | + city: string | null |
| 124 | + country: string | null |
| 125 | + district: string | null |
| 126 | + formattedAddress: string | null |
| 127 | + isoCountryCode: string | null |
| 128 | + name: string | null |
| 129 | + postalCode: string | null |
| 130 | + region: string | null |
| 131 | + street: string | null |
| 132 | + streetNumber: string | null |
| 133 | + subregion: string | null |
| 134 | + timezone: string | null |
| 135 | +} |
0 commit comments