From 153645dda4657fe113ad3e60a404332b4933aaa5 Mon Sep 17 00:00:00 2001 From: MoizAdnan Date: Thu, 27 Jun 2024 17:54:14 +0500 Subject: [PATCH] fixed errors --- .../src/admin/common/Location/LocationDrawer.tsx | 3 ++- .../src/admin/components/locations/AddEditLocationModal.tsx | 3 ++- .../src/admin/components/user/AddEditUserModal.tsx | 3 ++- packages/common/src/schemas/projects/project.schema.ts | 2 +- .../src/social/location-setting/location-setting.docs.ts | 2 -- packages/server-core/src/social/location/location.test.ts | 6 +++++- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/client-core/src/admin/common/Location/LocationDrawer.tsx b/packages/client-core/src/admin/common/Location/LocationDrawer.tsx index 2c4e424e3b..362c2643c3 100644 --- a/packages/client-core/src/admin/common/Location/LocationDrawer.tsx +++ b/packages/client-core/src/admin/common/Location/LocationDrawer.tsx @@ -32,6 +32,7 @@ import InputText from '@etherealengine/client-core/src/common/components/InputTe import { LocationData, LocationID, + LocationPatch, locationPath, LocationType, staticResourcePath @@ -215,7 +216,7 @@ const LocationDrawer = ({ open, mode, selectedLocation, selectedScene, onClose } NotificationService.dispatchNotify(error.message, { variant: 'error' }) }) } else if (selectedLocation) { - locationMutation.patch(selectedLocation.id, data).catch((error) => { + locationMutation.patch(selectedLocation.id, data as LocationPatch).catch((error) => { NotificationService.dispatchNotify(error.message, { variant: 'error' }) }) editMode.set(false) diff --git a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx index 83deea0895..b4ab8f93aa 100644 --- a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx +++ b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx @@ -25,6 +25,7 @@ import { PopoverState } from '@etherealengine/client-core/src/common/services/Po import { LocationData, LocationID, + LocationPatch, locationPath, LocationType, staticResourcePath @@ -118,7 +119,7 @@ export default function AddEditLocationModal({ try { if (location?.id) { - await locationMutation.patch(location.id, locationData) + await locationMutation.patch(location.id, locationData as LocationPatch) } else { await locationMutation.create(locationData) } diff --git a/packages/client-core/src/admin/components/user/AddEditUserModal.tsx b/packages/client-core/src/admin/components/user/AddEditUserModal.tsx index 1883d05d52..e8fe74c548 100644 --- a/packages/client-core/src/admin/components/user/AddEditUserModal.tsx +++ b/packages/client-core/src/admin/components/user/AddEditUserModal.tsx @@ -29,6 +29,7 @@ import { scopeTypePath, UserData, UserName, + UserPatch, userPath, UserType } from '@etherealengine/common/src/schema.type.module' @@ -121,7 +122,7 @@ export default function AddEditUserModal({ user }: { user?: UserType }) { submitLoading.set(true) try { if (user?.id) { - await userMutation.patch(user.id, userData) + await userMutation.patch(user.id, userData as UserPatch) } else { await userMutation.create(userData) } diff --git a/packages/common/src/schemas/projects/project.schema.ts b/packages/common/src/schemas/projects/project.schema.ts index 2b47338d0e..49b2f0812c 100644 --- a/packages/common/src/schemas/projects/project.schema.ts +++ b/packages/common/src/schemas/projects/project.schema.ts @@ -74,7 +74,7 @@ export interface ProjectType extends Static {} export interface ProjectDatabaseType extends Omit {} // Schema for creating new entries -export const projectDataSchema = Type.Partial(Type.Omit(projectSchema, ['id', 'createdAt', 'updatedAt']), { +export const projectDataSchema = Type.Partial(projectSchema, { $id: 'ProjectData' }) export interface ProjectData extends Static {} diff --git a/packages/server-core/src/social/location-setting/location-setting.docs.ts b/packages/server-core/src/social/location-setting/location-setting.docs.ts index 018a01b863..8ed16b1a14 100755 --- a/packages/server-core/src/social/location-setting/location-setting.docs.ts +++ b/packages/server-core/src/social/location-setting/location-setting.docs.ts @@ -26,7 +26,6 @@ Ethereal Engine. All Rights Reserved. import { createSwaggerServiceOptions } from 'feathers-swagger' import { - locationSettingDataSchema, locationSettingPatchSchema, locationSettingQuerySchema, locationSettingSchema @@ -34,7 +33,6 @@ import { export default createSwaggerServiceOptions({ schemas: { - locationSettingDataSchema, locationSettingPatchSchema, locationSettingQuerySchema, locationSettingSchema diff --git a/packages/server-core/src/social/location/location.test.ts b/packages/server-core/src/social/location/location.test.ts index 139dce3597..10d8984d91 100644 --- a/packages/server-core/src/social/location/location.test.ts +++ b/packages/server-core/src/social/location/location.test.ts @@ -31,6 +31,7 @@ import { LocationID, locationPath, LocationType } from '@etherealengine/common/s import { destroyEngine } from '@etherealengine/ecs/src/Engine' import { staticResourcePath } from '@etherealengine/common/src/schema.type.module' +import { getDateTimeSql } from '@etherealengine/common/src/utils/datetime-sql' import { Application } from '../../../declarations' import { createFeathersKoaApp } from '../../createApp' import { LocationParams } from './location.class' @@ -99,12 +100,15 @@ describe('location.test', () => { it('should be able to update the location', async () => { const newName = `Update Test Location ${uuidv4()}` const locationSetting = await app.service(locationSettingPath).create({ + id: uuidv4(), locationType: 'public', audioEnabled: true, videoEnabled: true, faceStreamingEnabled: false, screenSharingEnabled: false, - locationId: locations[0].id + locationId: locations[0].id, + createdAt: await getDateTimeSql(), + updatedAt: await getDateTimeSql() }) const locationData = JSON.parse(JSON.stringify(locations[0]))