Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mongoose): use official discriminator definitions #1704

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"lodash": "^4.17.21",
"moment-timezone": "0.5.33",
"mongodb-uri": "^0.9.7",
"mongoose": "^5.12.3",
"mongoose": "^5.12.5",
"multiparty": ">=4.2.2",
"neverthrow": "^4.2.1",
"ng-infinite-scroll": "^1.3.0",
Expand Down
8 changes: 4 additions & 4 deletions src/app/models/form.server.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const compileFormModel = (db: Mongoose): IFormModel => {
// Add discriminators for the various field types.
const FormFieldPath = FormSchema.path(
'form_fields',
) as Schema.Types.DocumentArrayWithLooseDiscriminator
) as Schema.Types.DocumentArray

const TableFieldSchema = createTableFieldSchema()

Expand Down Expand Up @@ -385,7 +385,7 @@ const compileFormModel = (db: Mongoose): IFormModel => {
FormFieldPath.discriminator(BasicField.Table, TableFieldSchema)
const TableColumnPath = TableFieldSchema.path(
'columns',
) as Schema.Types.DocumentArrayWithLooseDiscriminator
) as Schema.Types.DocumentArray
TableColumnPath.discriminator(
BasicField.ShortText,
createShortTextFieldSchema(),
Expand All @@ -398,13 +398,13 @@ const compileFormModel = (db: Mongoose): IFormModel => {
// Discriminator defines all possible values of startPage.logo
const StartPageLogoPath = FormSchema.path(
'startPage.logo',
) as Schema.Types.DocumentArrayWithLooseDiscriminator
) as Schema.Types.DocumentArray
StartPageLogoPath.discriminator(FormLogoState.Custom, CustomFormLogoSchema)

// Discriminator defines different logic types
const FormLogicPath = FormSchema.path(
'form_logics',
) as Schema.Types.DocumentArrayWithLooseDiscriminator
) as Schema.Types.DocumentArray

FormLogicPath.discriminator(LogicType.ShowFields, ShowFieldsLogicSchema)
FormLogicPath.discriminator(LogicType.PreventSubmit, PreventSubmitLogicSchema)
Expand Down
33 changes: 0 additions & 33 deletions src/types/vendor/mongoose.d.ts

This file was deleted.