Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,25 @@ export const getPhoneProviderValidationSchema = (config: ProjectAuthConfigData)
}),

// Phone SMS
SMS_OTP_EXP: number().min(0, 'Must be more than 0').required('This is required'),
SMS_OTP_LENGTH: number().min(6, 'Must be 6 or more in length').required('This is required'),
SMS_TEMPLATE: string().required('SMS template is required.'),
SMS_OTP_EXP: number()
.min(0, 'Must be more than 0')
.when('SMS_PROVIDER', {
is: (val: string) => val !== 'twilio_verify',
then: (schema) => schema.required('This is required'),
otherwise: (schema) => schema,
}),
SMS_OTP_LENGTH: number()
.min(6, 'Must be 6 or more in length')
.when('SMS_PROVIDER', {
is: (val: string) => val !== 'twilio_verify',
then: (schema) => schema.required('This is required'),
otherwise: (schema) => schema,
}),
SMS_TEMPLATE: string().when('SMS_PROVIDER', {
is: (val: string) => val !== 'twilio_verify',
then: (schema) => schema.required('SMS template is required.'),
otherwise: (schema) => schema,
}),
SMS_TEST_OTP: string()
.matches(
/^\s*([0-9]{1,15}=[0-9]+)(\s*,\s*[0-9]{1,15}=[0-9]+)*\s*$/g,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export const ColumnEditor = ({
>
<FormSectionContent loading={false} className="lg:!col-span-8">
<ColumnForeignKey
tableId={selectedTable.id}
column={columnFields}
relations={fkRelations}
closePanel={closePanel}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { useParams } from 'common'
import { useState } from 'react'
import { Button } from 'ui'

import { useForeignKeyConstraintsQuery } from 'data/database/foreign-key-constraints-query'
import { useTableEditorQuery } from 'data/table-editor/table-editor-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { useState } from 'react'
import { Button } from 'ui'

import { ForeignKeySelector } from '../ForeignKeySelector/ForeignKeySelector'
import type { ForeignKey } from '../ForeignKeySelector/ForeignKeySelector.types'
import type { ColumnField } from '../SidePanelEditor.types'
import { ForeignKeyRow } from '../TableEditor/ForeignKeysManagement/ForeignKeyRow'
import { checkIfRelationChanged } from '../TableEditor/ForeignKeysManagement/ForeignKeysManagement.utils'

interface ColumnForeignKeyProps {
tableId?: number
column: ColumnField
relations: ForeignKey[]
closePanel: () => void
Expand All @@ -20,6 +21,7 @@ interface ColumnForeignKeyProps {
}

const ColumnForeignKey = ({
tableId,
column,
relations,
closePanel,
Expand All @@ -29,7 +31,6 @@ const ColumnForeignKey = ({
const { id: _id } = useParams()
const [open, setOpen] = useState(false)
const [selectedFk, setSelectedFk] = useState<ForeignKey>()

const { data: project } = useSelectedProjectQuery()
const { data } = useForeignKeyConstraintsQuery({
projectRef: project?.ref,
Expand All @@ -41,7 +42,7 @@ const ColumnForeignKey = ({
const { data: table } = useTableEditorQuery({
projectRef: project?.ref,
connectionString: project?.connectionString,
id,
id: tableId ?? id,
})
const formattedColumnsForFkSelector = (table?.columns ?? []).map((c) => {
return {
Expand Down
Loading