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 email setting service to use schema, knex & feathers 5 (#…
…7883) * Changes for email setting service to use schema, knex, resolvers & validators * Fixed object parse * Changes as requested by feathers team in discord. * Added root schema validators for services previously migrated to schema. * Updates for email setting to work
- Loading branch information
1 parent
f8e072b
commit 494ef88
Showing
23 changed files
with
493 additions
and
275 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.
94 changes: 94 additions & 0 deletions
94
packages/engine/src/schemas/setting/email-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,94 @@ | ||
// // 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 emailSettingPath = 'email-setting' | ||
|
||
export const emailSettingMethods = ['find', 'get', 'create', 'patch', 'remove'] as const | ||
|
||
export const emailSubjectSchema = Type.Object( | ||
{ | ||
'new-user': Type.String(), | ||
location: Type.String(), | ||
instance: Type.String(), | ||
login: Type.String(), | ||
friend: Type.String(), | ||
group: Type.String(), | ||
party: Type.String() | ||
}, | ||
{ $id: 'EmailSubject', additionalProperties: false } | ||
) | ||
export type EmailSubjectType = Static<typeof emailSubjectSchema> | ||
|
||
export const emailAuthSchema = Type.Object( | ||
{ | ||
user: Type.String(), | ||
pass: Type.String() | ||
}, | ||
{ $id: 'EmailAuth', additionalProperties: false } | ||
) | ||
export type EmailAuthType = Static<typeof emailAuthSchema> | ||
|
||
export const emailSmtpSchema = Type.Object( | ||
{ | ||
host: Type.String(), | ||
port: Type.String(), | ||
secure: Type.Boolean(), | ||
auth: Type.Ref(emailAuthSchema) | ||
}, | ||
{ $id: 'EmailSmtp', additionalProperties: false } | ||
) | ||
export type EmailSmtpType = Static<typeof emailSmtpSchema> | ||
|
||
// Main data model schema | ||
export const emailSettingSchema = Type.Object( | ||
{ | ||
id: Type.String({ | ||
format: 'uuid' | ||
}), | ||
smtp: Type.Ref(emailSmtpSchema), | ||
from: Type.String(), | ||
subject: Type.Ref(emailSubjectSchema), | ||
smsNameCharacterLimit: Type.Number(), | ||
createdAt: Type.String({ format: 'date-time' }), | ||
updatedAt: Type.String({ format: 'date-time' }) | ||
}, | ||
{ $id: 'EmailSetting', additionalProperties: false } | ||
) | ||
export type EmailSettingType = Static<typeof emailSettingSchema> | ||
|
||
export type EmailSettingDatabaseType = Omit<EmailSettingType, 'smtp' | 'subject'> & { smtp: string; subject: string } | ||
|
||
// Schema for creating new entries | ||
export const emailSettingDataSchema = Type.Pick( | ||
emailSettingSchema, | ||
['smtp', 'from', 'subject', 'smsNameCharacterLimit'], | ||
{ | ||
$id: 'EmailSettingData' | ||
} | ||
) | ||
export type EmailSettingData = Static<typeof emailSettingDataSchema> | ||
|
||
// Schema for updating existing entries | ||
export const emailSettingPatchSchema = Type.Partial(emailSettingSchema, { | ||
$id: 'EmailSettingPatch' | ||
}) | ||
export type EmailSettingPatch = Static<typeof emailSettingPatchSchema> | ||
|
||
// Schema for allowed query properties | ||
export const emailSettingQueryProperties = Type.Pick(emailSettingSchema, [ | ||
'id', | ||
// 'smtp', Commented out because: https://discord.com/channels/509848480760725514/1093914405546229840/1095101536121667694 | ||
'from', | ||
// 'subject', | ||
'smsNameCharacterLimit' | ||
]) | ||
export const emailSettingQuerySchema = Type.Intersect( | ||
[ | ||
querySyntax(emailSettingQueryProperties), | ||
// Add additional query properties here | ||
Type.Object({}, { additionalProperties: false }) | ||
], | ||
{ additionalProperties: false } | ||
) | ||
export type EmailSettingQuery = Static<typeof emailSettingQuerySchema> |
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 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
Oops, something went wrong.