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

[wip] Custom Fields #5742

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

[wip] Custom Fields #5742

wants to merge 8 commits into from

Conversation

toplenboren
Copy link
Member

This PR adds the ability for engineers to add their custom data to the condo

@toplenboren toplenboren added 🔬 WIP Not intended to be merged right now, it is a work in progress 🚨 Migrations We have a database migrations here! 🐘 BIG No so easy to review changes up to 1300 lines of code labels Feb 3, 2025
if (user.isAdmin || user.isSupport) return true

const isBulkRequest = Array.isArray(originalInput)
// Bulk requests are not supported in canManageObjectsAsB2BAppServiceUser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo?

if (user.deletedAt) return false
if (user.isAdmin || user.isSupport) return true

const isBulkRequest = Array.isArray(originalInput)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it’s better to check by itemids variable. It’s more common

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u please clarify wym? Every isBulkRequest in code is const isBulkRequest = Array.isArray(originalInput)

locale: {
schemaDoc: 'Locale of this field, For example, if you create SSN field (social security number) you should use en-US locale. If not set, then it is considered that this CustomField is global and not region specific',
type: 'Text',
isRequired: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add options like user locale

validateInput: ({ resolvedData, fieldPath, addFieldValidationError }) => {
const value = resolvedData[fieldPath]
if (!(-100 < value && value <= 100)) {
return addFieldValidationError('priority should be between -100 and 100')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GQLError

const schemaIsValid = ajv.validateSchema(value)

if (!schemaIsValid) {
addFieldValidationError('Bad validation rules, should be valid json-schema')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GQLError

//template: 'miniapp.customField.*.name',
},

priority: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be updated?

Copy link
Member Author

@toplenboren toplenboren Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, priority can be updated anytime. This changes only order in which fields are displayed in UI

},
},

staffCanRead: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s cool to add some todos for the staffCanEdit and solid fields.

isRequired: true,
},

filterDataString: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date time and numbers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datetime is string, I think I'll just create a special type for that

isRequired: false,
},

isUniquePerObject: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be with access: read only

import { generateReactHooks } from '@open-condo/codegen/generate.hooks'
import { CustomValue as CustomValueGQL } from '@condo/domains/miniapp/gql'

// TODO(codegen): write utils like convertToFormState and formValuesProcessor if needed, otherwise delete this TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

….

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐘 BIG No so easy to review changes up to 1300 lines of code 🚨 Migrations We have a database migrations here! 🔬 WIP Not intended to be merged right now, it is a work in progress
Development

Successfully merging this pull request may close these issues.

2 participants