33 <div class =" input-container" >
44 <div class =" input-group" >
55 <label class =" relation-label" >Field name</label >
6- <input class =" relation-input" v-model =" fieldName" type =" text" />
6+ <input class =" relation-input" v-model =" fieldName" type =" text" maxlength = " 100 " />
77 </div >
88
99 <div class =" input-group" >
2727
2828 <div class =" input-group" >
2929 <label class =" relation-label" >Back populates</label >
30- <input class =" relation-input" v-model =" backPopulates" type =" text" />
30+ <input class =" relation-input" v-model =" backPopulates" type =" text" maxlength = " 100 " />
3131 </div >
3232 </div >
3333
4747import { ref , computed } from " vue"
4848import { useProjectStore } from " @/stores/useProjectStore"
4949import { useModalStore } from " @/stores/useModalStore"
50+ import type { OnDeleteType } from " @/types/types"
51+ import { isValidFieldName , warningMessages } from " @/utils/validation"
52+ import { showDangerToast } from " @/utils/toast"
5053
5154const props = defineProps <{
5255 id: string
@@ -67,11 +70,15 @@ const filteredNodes = computed(() => projectStore.nodes.filter((node) => node.id
6770
6871const saveSelect = () => {
6972 if (! selectedNodeId .value || ! fieldName .value ) return
73+ if (! isValidFieldName (fieldName .value )) {
74+ showDangerToast (warningMessages .fieldName )
75+ return
76+ }
7077 projectStore .addRelation (props .id , selectedNodeId .value , {
7178 fieldName: fieldName .value ,
7279 targetModel: selectedNodeId .value ,
7380 backPopulates: backPopulates .value ,
74- onDelete: onDelete .value ,
81+ onDelete: onDelete .value as OnDeleteType ,
7582 isNullable: nullable .value ,
7683 isUnique: unique .value ,
7784 isIndex: indexed .value ,
0 commit comments