diff --git a/docs/API-Accounts.md b/docs/API-Accounts.md index e3e016df..4fdfc289 100755 --- a/docs/API-Accounts.md +++ b/docs/API-Accounts.md @@ -40,7 +40,8 @@ are returned (limited by pagination). "path": "/X,Y,Z/X,Y,Z,W", "placeid": stringIdOfPlace, "domainid": stringIdOfDomain, - "availability": stringWhoCanSee // one of "all", "none", "connections", "friends" + "availability": stringWhoCanSee // one of "all", "none", "connections", + "friends": [] }, "profile_detail": {}, // account detail information "friends": [ "friendName", "friendName", ... ], @@ -49,7 +50,9 @@ are returned (limited by pagination). "enabled": true, // 'false' if waiting for email verification "roles": [ "role", "role", ... ], // roles of "user", "admin", ... "when_account_created": "YYYY-MM-DDTHH:MM:SS.MMMZ", + "when_account_created_s": 1617405661, "time_of_last_heartbeat": "YYYY-MM-DDTHH:MM:SS.MMMZ" + "time_of_last_heartbeat_s": 1627921261 }, ... ] @@ -146,7 +149,9 @@ The account fields that can be fetched: |roles | all | admin | stringArray | |ip_addr_of_creator | all | noone | string | |when_account_created | all | noone | ISODateString | +|when_account_created_s | all | noone | integerUnixTimeSeconds | |time_of_last_heartbeat | all | noone | ISODateString | +|time_of_last_heartbeat_s | all | noone | integerUnixTimeSeconds | The JSON structure returned looks like the regular REST response with the "data" object being the value requests. diff --git a/docs/API-Domains.md b/docs/API-Domains.md index 2a9325c1..75f9c286 100755 --- a/docs/API-Domains.md +++ b/docs/API-Domains.md @@ -60,9 +60,11 @@ A request returns an array of domain descriptions: "user_hostnames": []; }, "time_of_last_heartbeat": "YYYY-MM-DDTHH:MM:SS.MMMZ", + "time_of_last_heartbeat_s": 1627921261 "last_sender_key": stringHostPortSourceOfLastMessage, "addr_of_first_contact": stringHostPortOfDomainEntryCreation, - "when_domain_entry_created": "YYYY-MM-DDTHH:MM:SS.MMMZ" + "when_domain_entry_created": "YYYY-MM-DDTHH:MM:SS.MMMZ", + "when_domain_entry_created_s": 1617405661 }, ... ] @@ -158,7 +160,9 @@ The domain fields that can be fetched: | images | all | domain sponsor admin | stringArray | | addr_of_first_contact | all | noone | string | | when_domain_entry_created | all | noone | ISODateString | +| when_domain_entry_created_s | all | noone | integerUnixTimeSeconds | | time_of_last_heartbeat | all | noone | ISODateString | +| time_of_last_heartbeat_s | all | noone | integerUnixTimeSeconds | | last_sender_key | all | noone | string | The JSON structure returned looks like the regular REST response diff --git a/docs/API-Explore.md b/docs/API-Explore.md index f088ffcc..d2261f29 100644 --- a/docs/API-Explore.md +++ b/docs/API-Explore.md @@ -64,7 +64,8 @@ The response is a JSON array of Place descriptions. "current_attendance': number, // reported attendance at place "current_images': stringURLS[], "current_info': string, - "current_last_update_time': "ISODateString" + "current_last_update_time': "ISODateString", + "current_last_update_time_s': integerUnixTimeSeconds }, }, ... diff --git a/docs/API-Places.md b/docs/API-Places.md index f1723c36..6a96eefb 100755 --- a/docs/API-Places.md +++ b/docs/API-Places.md @@ -110,6 +110,7 @@ This request return JSON formatted as: 'protocol_version': string, // protocol version for domain-server 'active': boolean, // true if domain is heartbeating "time_of_last_heartbeat": ISOStringDate, + "time_of_last_heartbeat_s": integerUnixTimeSeconds, "num_users": integer }, "thumbnail": URL, @@ -117,7 +118,8 @@ This request return JSON formatted as: "current_attendance": number, "current_images": string[], "current_info": string, - "current_last_update_time": ISOStringDate + "current_last_update_time": ISOStringDate, + "current_last_update_time_s": integerUnixTimeSeconds }, ... ], @@ -247,9 +249,11 @@ The place fields that can be fetched: | current_images | all | domainOwner, manager, admin | stringArray | | current_info | all | domainOwner, manager, admin | string | | current_last_update_time | all | none | ISODateString | +| current_last_update_time_s | all | none | integerUnixTimeSeconds | | current_api_key | domainOwner, admin | none | string | | addr_of_first_contact | all | none | string | | when_place_entry_created | all | none | ISODateString | +| when_place_entry_created_s | all | none | integerUnixTimeSeconds | The JSON structure returned looks like the regular REST response with the "data" object being the value requests. diff --git a/docs/API-Profiles.md b/docs/API-Profiles.md index 41ce73a4..cab97dc0 100644 --- a/docs/API-Profiles.md +++ b/docs/API-Profiles.md @@ -43,7 +43,9 @@ have "availability" set to "all" are returned. "friends": [ "friendName", "friendName", ... ], "connections": [ "connectionName", "connectionName", ...], "when_account_created": "YYYY-MM-DDTHH:MM:SS.MMMZ", + "when_account_created_s": integerUnixTimeSeconds, "time_of_last_heartbeat": "YYYY-MM-DDTHH:MM:SS.MMMZ" + "time_of_last_heartbeat_s": integerUnixTimeSeconds }, ... ] diff --git a/src/route-tools/Util.ts b/src/route-tools/Util.ts index 74e94ecf..f828e3bd 100755 --- a/src/route-tools/Util.ts +++ b/src/route-tools/Util.ts @@ -139,7 +139,8 @@ export async function buildDomainInfo(pDomain: DomainEntity): Promise { 'version': pDomain.version, 'protocol_version': pDomain.protocol, 'active': pDomain.active ?? false, - 'time_of_last_heartbeat': pDomain.timeOfLastHeartbeat ? pDomain.timeOfLastHeartbeat.toISOString() : undefined, + 'time_of_last_heartbeat': pDomain.timeOfLastHeartbeat?.toISOString(), + 'time_of_last_heartbeat_s': pDomain.timeOfLastHeartbeat?.getTime().toString(), 'num_users': pDomain.numUsers + pDomain.anonUsers }; }; @@ -188,10 +189,12 @@ export async function buildDomainInfoV1(pDomain: DomainEntity): Promise { 'num_users': pDomain.numUsers, 'user_hostnames': pDomain.hostnames }, - 'time_of_last_heartbeat': pDomain.timeOfLastHeartbeat ? pDomain.timeOfLastHeartbeat.toISOString() : undefined, + 'time_of_last_heartbeat': pDomain.timeOfLastHeartbeat?.toISOString(), + 'time_of_last_heartbeat_s': pDomain.timeOfLastHeartbeat?.getTime().toString(), 'last_sender_key': pDomain.lastSenderKey, 'addr_of_first_contact': pDomain.iPAddrOfFirstContact, - 'when_domain_entry_created': pDomain.whenCreated ? pDomain.whenCreated.toISOString() : undefined + 'when_domain_entry_created': pDomain.whenCreated?.toISOString(), + 'when_domain_entry_created_s': pDomain.whenCreated?.getTime().toString() }; }; @@ -236,8 +239,10 @@ export async function buildAccountInfo(pReq: Request, pAccount: AccountEntity): 'location': await buildLocationInfo(pAccount), 'friends': pAccount.friends, 'connections': pAccount.connections, - 'when_account_created': pAccount.whenCreated ? pAccount.whenCreated.toISOString() : undefined, - 'time_of_last_heartbeat': pAccount.timeOfLastHeartbeat ? pAccount.timeOfLastHeartbeat.toISOString() : undefined + 'when_account_created': pAccount.whenCreated?.toISOString(), + 'when_account_created_s': pAccount.whenCreated?.getTime().toString(), + 'time_of_last_heartbeat': pAccount.timeOfLastHeartbeat?.toISOString(), + 'time_of_last_heartbeat_s': pAccount.timeOfLastHeartbeat?.getTime().toString(), }; }; // Return the block of account information used as the account 'profile'. @@ -254,8 +259,10 @@ export async function buildAccountProfile(pReq: Request, pAccount: AccountEntity }, 'profile_detail': pAccount.profileDetail, 'location': await buildLocationInfo(pAccount), - 'when_account_created': pAccount.whenCreated ? pAccount.whenCreated.toISOString() : undefined, - 'time_of_last_heartbeat': pAccount.timeOfLastHeartbeat ? pAccount.timeOfLastHeartbeat.toISOString() : undefined + 'when_account_created': pAccount.whenCreated?.toISOString(), + 'when_account_created_s': pAccount.whenCreated?.getTime().toString(), + 'time_of_last_heartbeat': pAccount.timeOfLastHeartbeat?.toISOString(), + 'time_of_last_heartbeat_s': pAccount.timeOfLastHeartbeat?.getTime().toString(), }; }; @@ -291,8 +298,10 @@ export async function buildPlaceInfoSmall(pPlace: PlaceEntity, pDomain?: DomainE 'current_attendance': pPlace.currentAttendance ?? 0, 'current_images': pPlace.currentImages, 'current_info': pPlace.currentInfo, - 'current_last_update_time': pPlace.currentLastUpdateTime, - 'last_activity_update': pPlace.lastActivity + 'current_last_update_time': pPlace.currentLastUpdateTime?.toISOString(), + 'current_last_update_time_s': pPlace.currentLastUpdateTime?.getTime().toString(), + 'last_activity_update': pPlace.lastActivity?.toISOString(), + 'last_activity_update_s': pPlace.lastActivity?.getTime().toString() }; return ret; }; diff --git a/src/routes/api/v1/requests.ts b/src/routes/api/v1/requests.ts index 77fe74e1..8213b696 100755 --- a/src/routes/api/v1/requests.ts +++ b/src/routes/api/v1/requests.ts @@ -39,8 +39,10 @@ const procGetRequests: RequestHandler = async (req: Request, resp: Response, nex 'type': aReq.requestType, 'requesting_account_id': aReq.requestingAccountId, 'target_account_id': aReq.targetAccountId, - 'when_created': aReq.whenCreated ? aReq.whenCreated.toISOString() : undefined, - 'expiration_time': aReq.expirationTime ? aReq.expirationTime.toISOString() : undefined + 'when_created': aReq.whenCreated?.toISOString(), + 'when_created_s': aReq.whenCreated?.getTime().toString(), + 'expiration_time': aReq.expirationTime?.toISOString(), + 'expiration_time_s': aReq.expirationTime?.getTime().toString() }; switch (aReq.requestType) { case RequestType.HANDSHAKE: diff --git a/src/routes/api/v1/tokens.ts b/src/routes/api/v1/tokens.ts index 1030274e..437717ec 100755 --- a/src/routes/api/v1/tokens.ts +++ b/src/routes/api/v1/tokens.ts @@ -42,8 +42,10 @@ const procGetTokens: RequestHandler = async (req: Request, resp: Response, next: 'accountId': tok.accountId, 'refresh_token': tok.refreshToken, 'scope': tok.scope, - 'creation_time': tok.whenCreated ? tok.whenCreated.toISOString() : undefined, - 'expiration_time': tok.expirationTime ? tok.expirationTime.toISOString() : undefined, + 'creation_time': tok.whenCreated?.toISOString(), + 'creation_time_s': tok.whenCreated?.getTime().toString(), + 'expiration_time': tok.expirationTime?.toISOString(), + 'expiration_time_s': tok.expirationTime?.getTime().toString() }); };