diff --git a/src/context.ts b/src/context.ts index ecf59da..5df2103 100644 --- a/src/context.ts +++ b/src/context.ts @@ -86,7 +86,7 @@ export class Context { maxzoom: getStyleMaxZoom(style), minzoom: getStyleMinZoom(style), estimatedSizeBytes: stats.size, - mapCreated: stats.ctimeMs, + mapCreatedAt: stats.ctimeMs, } } getReader(mapId: string) { diff --git a/src/lib/map-share.ts b/src/lib/map-share.ts index b8e058c..77709e4 100644 --- a/src/lib/map-share.ts +++ b/src/lib/map-share.ts @@ -38,7 +38,7 @@ export class MapShare extends TypedEventTarget< (baseUrl) => new URL(`${shareId}`, addTrailingSlash(baseUrl)).href, ), receiverDeviceId, - mapShareCreated: Date.now(), + mapShareCreatedAt: Date.now(), status: 'pending', } } diff --git a/src/routes/maps.ts b/src/routes/maps.ts index a1e2bb1..5817616 100644 --- a/src/routes/maps.ts +++ b/src/routes/maps.ts @@ -30,7 +30,7 @@ export function MapsRouter({ base = '/' }, ctx: Context) { router.get(`/:mapId/info`, async (request) => { const info = await ctx.getMapInfo(request.params.mapId) return { - created: info.mapCreated, + created: info.mapCreatedAt, size: info.estimatedSizeBytes, name: info.mapName, } diff --git a/src/types.ts b/src/types.ts index b5b605e..5be0a1a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -98,7 +98,7 @@ const MapInfo = T.Object({ ), minzoom: T.Number({ description: 'The minimum zoom level of the map data' }), maxzoom: T.Number({ description: 'The maximum zoom level of the map data' }), - mapCreated: T.Number({ + mapCreatedAt: T.Number({ description: 'Timestamp (ms since epoch) when the map was created', }), }) @@ -110,7 +110,7 @@ const MapShareBase = T.Intersect([ }), shareId: ShareId, mapShareUrls: MapShareUrls, - mapShareCreated: T.Number({ + mapShareCreatedAt: T.Number({ description: 'Timestamp (ms since epoch) when the map share was created', }), }), diff --git a/test/map-shares.test.ts b/test/map-shares.test.ts index c086fc3..72d4355 100644 --- a/test/map-shares.test.ts +++ b/test/map-shares.test.ts @@ -34,15 +34,15 @@ describe('Map Shares and Downloads', () => { const share = await response.json() const { shareId, - mapShareCreated, + mapShareCreatedAt, // eslint-disable-next-line @typescript-eslint/no-unused-vars - mapCreated, + mapCreatedAt: mapCreated, mapShareUrls, ...deterministic } = share as MapShareState expect(deterministic).toMatchSnapshot() - expect(mapShareCreated).toBeGreaterThanOrEqual(timeBeforeRequest) - expect(mapShareCreated).toBeLessThanOrEqual(Date.now()) + expect(mapShareCreatedAt).toBeGreaterThanOrEqual(timeBeforeRequest) + expect(mapShareCreatedAt).toBeLessThanOrEqual(Date.now()) expect(mapShareUrls.length).toBeGreaterThanOrEqual(1) expect(mapShareUrls[0]).toMatch(`/mapShares/${shareId}`) expect(share).toHaveProperty('status', 'pending')