Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Change to fix datetime timezone issue (#8625)
Browse files Browse the repository at this point in the history
* Changes to fix timezone issues

* Update datetime class

* Fixed formatting
  • Loading branch information
hanzlamateen authored Aug 30, 2023
1 parent a28c591 commit 72d46ed
Show file tree
Hide file tree
Showing 66 changed files with 293 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { instanceAttendancePath } from '@etherealengine/engine/src/schemas/netwo
import { InstanceID } from '@etherealengine/engine/src/schemas/networking/instance.schema'
import { userKickPath } from '@etherealengine/engine/src/schemas/user/user-kick.schema'
import { UserID, userPath } from '@etherealengine/engine/src/schemas/user/user.schema'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/get-datetime-sql'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/datetime-sql'
import ConfirmDialog from '../../../common/components/ConfirmDialog'
import { NotificationService } from '../../../common/services/NotificationService'
import DrawerView from '../../common/DrawerView'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { UserID } from '@etherealengine/engine/src/schemas/user/user.schema'

import { useFind, useMutation } from '@etherealengine/engine/src/common/functions/FeathersHooks'
import { InviteType, invitePath } from '@etherealengine/engine/src/schemas/social/invite.schema'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/get-datetime-sql'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/datetime-sql'
import { INVITE_PAGE_LIMIT } from '../../../social/services/InviteService'
import TableComponent from '../../common/Table'
import { InviteColumn, inviteColumns } from '../../common/variables/invite'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { useFind } from '@etherealengine/engine/src/common/functions/FeathersHoo
import { InviteData } from '@etherealengine/engine/src/schemas/social/invite.schema'
import { locationPath } from '@etherealengine/engine/src/schemas/social/location.schema'
import { userPath } from '@etherealengine/engine/src/schemas/user/user.schema'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/get-datetime-sql'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/datetime-sql'
import { NotificationService } from '../../../common/services/NotificationService'
import { InviteService } from '../../../social/services/InviteService'
import DrawerView from '../../common/DrawerView'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { Engine } from '@etherealengine/engine/src/ecs/classes/Engine'
import { InvitePatch, InviteType, invitePath } from '@etherealengine/engine/src/schemas/social/invite.schema'
import { locationPath } from '@etherealengine/engine/src/schemas/social/location.schema'
import { userPath } from '@etherealengine/engine/src/schemas/user/user.schema'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/get-datetime-sql'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/datetime-sql'
import { Id } from '@feathersjs/feathers'
import { NotificationService } from '../../../common/services/NotificationService'
import DrawerView from '../../common/DrawerView'
Expand Down
2 changes: 1 addition & 1 deletion packages/instanceserver/src/NetworkFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { instanceAuthorizedUserPath } from '@etherealengine/engine/src/schemas/n
import { inviteCodeLookupPath } from '@etherealengine/engine/src/schemas/social/invite-code-lookup.schema'
import { userKickPath } from '@etherealengine/engine/src/schemas/user/user-kick.schema'
import { UserID, UserType } from '@etherealengine/engine/src/schemas/user/user.schema'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/get-datetime-sql'
import { toDateTimeSql } from '@etherealengine/server-core/src/util/datetime-sql'
import { InstanceServerState } from './InstanceServerState'
import { SocketWebRTCServerNetwork, WebRTCTransportExtension } from './SocketWebRTCServerFunctions'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import { AnalyticsQuery, AnalyticsType } from '@etherealengine/engine/src/schemas/analytics/analytics.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const analyticsResolver = resolve<AnalyticsType, HookContext>({})
export const analyticsResolver = resolve<AnalyticsType, HookContext>({
createdAt: virtual(async (analytics) => fromDateTimeSql(analytics.createdAt)),
updatedAt: virtual(async (analytics) => fromDateTimeSql(analytics.updatedAt))
})

export const analyticsExternalResolver = resolve<AnalyticsType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { v4 } from 'uuid'
import { analyticsPath, AnalyticsType } from '@etherealengine/engine/src/schemas/analytics/analytics.schema'
import appConfig from '@etherealengine/server-core/src/appconfig'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { getDateTimeSql } from '../../util/datetime-sql'

export async function seed(knex: Knex): Promise<void> {
const { testEnabled } = appConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import { BotCommandQuery, BotCommandType } from '@etherealengine/engine/src/schemas/bot/bot-command.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const botCommandResolver = resolve<BotCommandType, HookContext>({})
export const botCommandResolver = resolve<BotCommandType, HookContext>({
createdAt: virtual(async (botCommand) => fromDateTimeSql(botCommand.createdAt)),
updatedAt: virtual(async (botCommand) => fromDateTimeSql(botCommand.updatedAt))
})

export const botCommandExternalResolver = resolve<BotCommandType, HookContext>({})

Expand Down
6 changes: 4 additions & 2 deletions packages/server-core/src/bot/bot/bot.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from '@etherealengine/engine/src/schemas/bot/bot-command.schema'
import { InstanceType, instancePath } from '@etherealengine/engine/src/schemas/networking/instance.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'
import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'
import { botCommandDataResolver } from '../bot-command/bot-command.resolvers'

export const botResolver = resolve<BotType, HookContext>({})
Expand Down Expand Up @@ -65,7 +65,9 @@ export const botExternalResolver = resolve<BotType, HookContext>({
})) as BotCommandType[]
return botCommands
}
})
}),
createdAt: virtual(async (bot) => fromDateTimeSql(bot.createdAt)),
updatedAt: virtual(async (bot) => fromDateTimeSql(bot.updatedAt))
})

export const botDataResolver = resolve<BotType, HookContext>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'

import { BuildStatusQuery, BuildStatusType } from '@etherealengine/engine/src/schemas/cluster/build-status.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const buildStatusResolver = resolve<BuildStatusType, HookContext>({})
export const buildStatusResolver = resolve<BuildStatusType, HookContext>({
createdAt: virtual(async (buildStatus) => fromDateTimeSql(buildStatus.createdAt)),
updatedAt: virtual(async (buildStatus) => fromDateTimeSql(buildStatus.updatedAt))
})

export const buildStatusExternalResolver = resolve<BuildStatusType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import {
Expand All @@ -33,9 +33,12 @@ import {
} from '@etherealengine/engine/src/schemas/matchmaking/match-instance.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const matchInstanceResolver = resolve<MatchInstanceType, HookContext>({})
export const matchInstanceResolver = resolve<MatchInstanceType, HookContext>({
createdAt: virtual(async (matchInstance) => fromDateTimeSql(matchInstance.createdAt)),
updatedAt: virtual(async (matchInstance) => fromDateTimeSql(matchInstance.updatedAt))
})

export const matchInstanceExternalResolver = resolve<MatchInstanceType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import { MatchTicketQuery, MatchTicketType } from '@etherealengine/matchmaking/src/match-ticket.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const matchTicketResolver = resolve<MatchTicketType, HookContext>({})
export const matchTicketResolver = resolve<MatchTicketType, HookContext>({
createdAt: virtual(async (matchTicket) => (matchTicket.createdAt ? fromDateTimeSql(matchTicket.createdAt) : '')),
updatedAt: virtual(async (matchTicket) => (matchTicket.updatedAt ? fromDateTimeSql(matchTicket.updatedAt) : ''))
})

export const matchTicketExternalResolver = resolve<MatchTicketType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import { MatchUserQuery, MatchUserType } from '@etherealengine/engine/src/schemas/matchmaking/match-user.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const matchUserResolver = resolve<MatchUserType, HookContext>({})
export const matchUserResolver = resolve<MatchUserType, HookContext>({
createdAt: virtual(async (matchUser) => fromDateTimeSql(matchUser.createdAt)),
updatedAt: virtual(async (matchUser) => fromDateTimeSql(matchUser.updatedAt))
})

export const matchUserExternalResolver = resolve<MatchUserType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import {
Expand All @@ -34,9 +34,7 @@ import {
} from '@etherealengine/engine/src/schemas/media/static-resource.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'
import { nanoid } from 'nanoid'
import { getDateTimeSql } from '../../util/get-datetime-sql'

export const staticResourceResolver = resolve<StaticResourceType, HookContext>({})
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const staticResourceDbToSchema = (rawData: StaticResourceDatabaseType): StaticResourceType => {
let metadata = JSON.parse(rawData.metadata) as any
Expand Down Expand Up @@ -71,6 +69,11 @@ export const staticResourceDbToSchema = (rawData: StaticResourceDatabaseType): S
}
}

export const staticResourceResolver = resolve<StaticResourceType, HookContext>({
createdAt: virtual(async (staticResource) => fromDateTimeSql(staticResource.createdAt)),
updatedAt: virtual(async (staticResource) => fromDateTimeSql(staticResource.updatedAt))
})

export const staticResourceExternalResolver = resolve<StaticResourceType, HookContext>(
{},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import {
Expand All @@ -33,9 +33,12 @@ import {
} from '@etherealengine/engine/src/schemas/networking/instance-attendance.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const instanceAttendanceResolver = resolve<InstanceAttendanceType, HookContext>({})
export const instanceAttendanceResolver = resolve<InstanceAttendanceType, HookContext>({
createdAt: virtual(async (instanceAttendance) => fromDateTimeSql(instanceAttendance.createdAt)),
updatedAt: virtual(async (instanceAttendance) => fromDateTimeSql(instanceAttendance.updatedAt))
})

export const instanceAttendanceExternalResolver = resolve<InstanceAttendanceType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import {
Expand All @@ -33,9 +33,12 @@ import {
} from '@etherealengine/engine/src/schemas/networking/instance-authorized-user.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const instanceAuthorizedUserResolver = resolve<InstanceAuthorizedUserType, HookContext>({})
export const instanceAuthorizedUserResolver = resolve<InstanceAuthorizedUserType, HookContext>({
createdAt: virtual(async (instanceAuthorizedUser) => fromDateTimeSql(instanceAuthorizedUser.createdAt)),
updatedAt: virtual(async (instanceAuthorizedUser) => fromDateTimeSql(instanceAuthorizedUser.updatedAt))
})

export const instanceAuthorizedUserExternalResolver = resolve<InstanceAuthorizedUserType, HookContext>({})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ import {
import type { HookContext } from '@etherealengine/server-core/declarations'

import { userPath } from '@etherealengine/engine/src/schemas/user/user.schema'
import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const projectPermissionResolver = resolve<ProjectPermissionType, HookContext>({
user: virtual(async (projectPermission, context) => {
if (projectPermission.userId) {
const user = await context.app.service(userPath)._get(projectPermission.userId)
return user
}
})
}),
createdAt: virtual(async (projectPermission) => fromDateTimeSql(projectPermission.createdAt)),
updatedAt: virtual(async (projectPermission) => fromDateTimeSql(projectPermission.updatedAt))
})

export const projectPermissionExternalResolver = resolve<ProjectPermissionType, HookContext>({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ import {
RecordingResourceQuery,
RecordingResourceType
} from '@etherealengine/engine/src/schemas/recording/recording-resource.schema'
import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const recordingResourceResolver = resolve<RecordingResourceType, HookContext>({
staticResource: virtual(async (recordingResource, context) => {
const staticResource = await context.app.service(staticResourcePath).get(recordingResource.staticResourceId)
return staticResource
})
}),
createdAt: virtual(async (recordingResource) => fromDateTimeSql(recordingResource.createdAt)),
updatedAt: virtual(async (recordingResource) => fromDateTimeSql(recordingResource.updatedAt))
})

export const recordingResourceExternalResolver = resolve<RecordingResourceType, HookContext>({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
RecordingType
} from '@etherealengine/engine/src/schemas/recording/recording.schema'
import { userPath } from '@etherealengine/engine/src/schemas/user/user.schema'
import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const recordingDbToSchema = (rawData: RecordingDatabaseType): RecordingType => {
let schema = JSON.parse(rawData.schema) as RecordingSchemaType
Expand Down Expand Up @@ -72,7 +72,9 @@ export const recordingResolver = resolve<RecordingType, HookContext>({
const user = await context.app.service(userPath)._get(recording.userId)

return user.name
})
}),
createdAt: virtual(async (recording) => fromDateTimeSql(recording.createdAt)),
updatedAt: virtual(async (recording) => fromDateTimeSql(recording.updatedAt))
})

export const recordingExternalResolver = resolve<RecordingType, HookContext>(
Expand Down
9 changes: 6 additions & 3 deletions packages/server-core/src/route/route/route.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'
import { v4 } from 'uuid'

import { RouteQuery, RouteType } from '@etherealengine/engine/src/schemas/route/route.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const routeResolver = resolve<RouteType, HookContext>({})
export const routeResolver = resolve<RouteType, HookContext>({
createdAt: virtual(async (route) => fromDateTimeSql(route.createdAt)),
updatedAt: virtual(async (route) => fromDateTimeSql(route.updatedAt))
})

export const routeExternalResolver = resolve<RouteType, HookContext>({})

Expand Down
2 changes: 1 addition & 1 deletion packages/server-core/src/route/route/route.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { v4 } from 'uuid'
import { routePath, RouteType } from '@etherealengine/engine/src/schemas/route/route.schema'
import appConfig from '@etherealengine/server-core/src/appconfig'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { getDateTimeSql } from '../../util/datetime-sql'

export async function seed(knex: Knex): Promise<void> {
const { testEnabled } = appConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ Ethereal Engine. All Rights Reserved.
*/

// For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
import { resolve } from '@feathersjs/schema'
import { resolve, virtual } from '@feathersjs/schema'

import { ScopeTypeQuery, ScopeTypeType } from '@etherealengine/engine/src/schemas/scope/scope-type.schema'
import type { HookContext } from '@etherealengine/server-core/declarations'

import { getDateTimeSql } from '../../util/get-datetime-sql'
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'

export const scopeTypeResolver = resolve<ScopeTypeType, HookContext>({})
export const scopeTypeResolver = resolve<ScopeTypeType, HookContext>({
createdAt: virtual(async (scopeType) => fromDateTimeSql(scopeType.createdAt)),
updatedAt: virtual(async (scopeType) => fromDateTimeSql(scopeType.updatedAt))
})

export const scopeTypeExternalResolver = resolve<ScopeTypeType, HookContext>({})

Expand Down
Loading

0 comments on commit 72d46ed

Please sign in to comment.