|
11 | 11 | data: Partial<Models.AttributeRelationship>
|
12 | 12 | ) {
|
13 | 13 | if (!isValueOfStringEnum(RelationshipType, data.relationType)) {
|
14 |
| - throw new Error(`Invalid relationship type: ${data.relationType}`); |
| 14 | + throw new Error( |
| 15 | + `Invalid relationship type${data.relationType ? ` : ${data.relationType}` : ''}` |
| 16 | + ); |
15 | 17 | }
|
16 | 18 | if (!isValueOfStringEnum(RelationMutate, data.onDelete)) {
|
17 |
| - throw new Error(`Invalid on delete: ${data.onDelete}`); |
| 19 | + throw new Error(`Invalid deletion method${data.onDelete ? ` : ${data.onDelete}` : ''}`); |
18 | 20 | }
|
19 | 21 |
|
20 | 22 | await sdk
|
|
137 | 139 | $: search = data.relatedCollection || undefined;
|
138 | 140 |
|
139 | 141 | $: if (search) {
|
140 |
| - const exists = collectionList.collections?.some((c) => |
| 142 | + const exists = collectionList?.collections?.some((c) => |
141 | 143 | c.$id.toLocaleLowerCase().includes(search.toLocaleLowerCase())
|
142 | 144 | );
|
143 | 145 |
|
|
157 | 159 | name="one"
|
158 | 160 | value="one"
|
159 | 161 | icon={IconArrowSmRight}>
|
160 |
| - <p>One Relation attribute within this collection</p> |
| 162 | + One Relation attribute within this collection |
161 | 163 | </Card.Selector>
|
162 | 164 | <Card.Selector
|
163 | 165 | title="Two-way relationship"
|
164 | 166 | bind:group={way}
|
165 | 167 | name="two"
|
166 | 168 | value="two"
|
167 | 169 | icon={IconSwitchHorizontal}>
|
168 |
| - <p> |
169 |
| - One Relation attribute within this collection and another within the related collection |
170 |
| - </p> |
| 170 | + One Relation attribute within this collection and another within the related collection |
171 | 171 | </Card.Selector>
|
172 | 172 | </Layout.Stack>
|
173 | 173 |
|
|
179 | 179 | bind:value={data.relatedCollection}
|
180 | 180 | on:change={updateKeyName}
|
181 | 181 | options={collections?.map((n) => ({ value: n.$id, label: `${n.name} (${n.$id})` })) ?? []} />
|
| 182 | + |
182 | 183 | {#if data?.relatedCollection}
|
183 | 184 | <InputText
|
184 | 185 | id="key"
|
|
207 | 208 | placeholder="Select a relation"
|
208 | 209 | options={relationshipType}
|
209 | 210 | disabled={editing} />
|
| 211 | + |
210 | 212 | <div class="u-flex u-flex-vertical u-gap-16">
|
211 | 213 | <Box>
|
212 | 214 | <div class="u-flex u-align u-cross-center u-main-center u-gap-32">
|
213 | 215 | <span data-private>{camelize($collection.name)}</span>
|
214 | 216 | {#if data.twoWay}
|
215 | 217 | <img src={arrowTwo} alt={'Two way relationship'} />
|
216 | 218 | {:else}
|
217 |
| - <img src={arrowOne} alt={'One way realationship'} /> |
| 219 | + <img src={arrowOne} alt={'One way relationship'} /> |
218 | 220 | {/if}
|
219 | 221 | <span>{data.key}</span>
|
220 | 222 | </div>
|
|
0 commit comments