This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes for instance server setting service to use schema, knex & fea…
…thers 5 (#8081)
- Loading branch information
1 parent
d839d9a
commit 84d7a2f
Showing
19 changed files
with
401 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
packages/engine/src/schemas/setting/instance-server-setting.schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// // For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html | ||
import { querySyntax, Type } from '@feathersjs/typebox' | ||
import type { Static } from '@feathersjs/typebox' | ||
|
||
export const instanceServerSettingPath = 'instance-server-setting' | ||
|
||
export const instanceServerSettingMethods = ['find', 'get', 'create', 'patch', 'remove'] as const | ||
|
||
// Main data model schema | ||
export const instanceServerSettingSchema = Type.Object( | ||
{ | ||
id: Type.String({ | ||
format: 'uuid' | ||
}), | ||
clientHost: Type.String(), | ||
rtcStartPort: Type.Integer(), | ||
rtcEndPort: Type.Integer(), | ||
rtcPortBlockSize: Type.Integer(), | ||
identifierDigits: Type.Integer(), | ||
local: Type.Boolean(), | ||
domain: Type.String(), | ||
releaseName: Type.String(), | ||
port: Type.String(), | ||
mode: Type.String(), | ||
locationName: Type.String(), | ||
createdAt: Type.String({ format: 'date-time' }), | ||
updatedAt: Type.String({ format: 'date-time' }) | ||
}, | ||
{ $id: 'InstanceServerSetting', additionalProperties: false } | ||
) | ||
export type InstanceServerSettingType = Static<typeof instanceServerSettingSchema> | ||
|
||
// Schema for creating new entries | ||
export const instanceServerSettingDataSchema = Type.Pick( | ||
instanceServerSettingSchema, | ||
[ | ||
'clientHost', | ||
'rtcStartPort', | ||
'rtcEndPort', | ||
'rtcPortBlockSize', | ||
'identifierDigits', | ||
'local', | ||
'domain', | ||
'releaseName', | ||
'port', | ||
'mode', | ||
'locationName' | ||
], | ||
{ | ||
$id: 'InstanceServerSettingData' | ||
} | ||
) | ||
export type InstanceServerSettingData = Static<typeof instanceServerSettingDataSchema> | ||
|
||
// Schema for updating existing entries | ||
export const instanceServerSettingPatchSchema = Type.Partial(instanceServerSettingSchema, { | ||
$id: 'InstanceServerSettingPatch' | ||
}) | ||
export type InstanceServerSettingPatch = Static<typeof instanceServerSettingPatchSchema> | ||
|
||
// Schema for allowed query properties | ||
export const instanceServerSettingQueryProperties = Type.Pick(instanceServerSettingSchema, [ | ||
'id', | ||
'clientHost', | ||
'rtcStartPort', | ||
'rtcEndPort', | ||
'rtcPortBlockSize', | ||
'identifierDigits', | ||
'local', | ||
'domain', | ||
'releaseName', | ||
'port', | ||
'mode', | ||
'locationName' | ||
]) | ||
export const instanceServerSettingQuerySchema = Type.Intersect( | ||
[ | ||
querySyntax(instanceServerSettingQueryProperties), | ||
// Add additional query properties here | ||
Type.Object({}, { additionalProperties: false }) | ||
], | ||
{ additionalProperties: false } | ||
) | ||
export type InstanceServerSettingQuery = Static<typeof instanceServerSettingQuerySchema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 20 additions & 13 deletions
33
packages/server-core/src/setting/instance-server-setting/instance-server-setting.class.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { SequelizeServiceOptions, Service } from 'feathers-sequelize' | ||
import type { Params } from '@feathersjs/feathers' | ||
import { KnexService } from '@feathersjs/knex' | ||
import type { KnexAdapterParams } from '@feathersjs/knex' | ||
|
||
import { InstanceServerSetting as InstanceServerSettingInterface } from '@etherealengine/common/src/interfaces/InstanceServerSetting' | ||
import { | ||
InstanceServerSettingData, | ||
InstanceServerSettingPatch, | ||
InstanceServerSettingQuery, | ||
InstanceServerSettingType | ||
} from '@etherealengine/engine/src/schemas/setting/instance-server-setting.schema' | ||
|
||
import { Application } from '../../../declarations' | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface InstanceServerSettingParams extends KnexAdapterParams<InstanceServerSettingQuery> {} | ||
|
||
export type InstanceServerSettingDataType = InstanceServerSettingInterface | ||
|
||
export class InstanceServerSetting<T = InstanceServerSettingDataType> extends Service<T> { | ||
app: Application | ||
|
||
constructor(options: Partial<SequelizeServiceOptions>, app: Application) { | ||
super(options) | ||
this.app = app | ||
} | ||
} | ||
export class InstanceServerSettingService< | ||
T = InstanceServerSettingType, | ||
ServiceParams extends Params = InstanceServerSettingParams | ||
> extends KnexService< | ||
InstanceServerSettingType, | ||
InstanceServerSettingData, | ||
InstanceServerSettingParams, | ||
InstanceServerSettingPatch | ||
> {} |
21 changes: 21 additions & 0 deletions
21
packages/server-core/src/setting/instance-server-setting/instance-server-setting.docs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createSwaggerServiceOptions } from 'feathers-swagger' | ||
|
||
import { | ||
instanceServerSettingDataSchema, | ||
instanceServerSettingPatchSchema, | ||
instanceServerSettingQuerySchema, | ||
instanceServerSettingSchema | ||
} from '@etherealengine/engine/src/schemas/setting/instance-server-setting.schema' | ||
|
||
export default createSwaggerServiceOptions({ | ||
schemas: { | ||
instanceServerSettingDataSchema, | ||
instanceServerSettingPatchSchema, | ||
instanceServerSettingQuerySchema, | ||
instanceServerSettingSchema | ||
}, | ||
docs: { | ||
description: 'Instance server setting service description', | ||
securities: ['all'] | ||
} | ||
}) |
57 changes: 50 additions & 7 deletions
57
packages/server-core/src/setting/instance-server-setting/instance-server-setting.hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.