(template: Template, nook?: NookId)
| 62 | } |
| 63 | |
| 64 | function domainToEditRemote(template: Template, nook?: NookId) { |
| 65 | const remoteIds = objEntries(template.remotes) |
| 66 | .map(([k, v]) => { |
| 67 | if (nook == null || k === nook) return v?.remoteTemplateId |
| 68 | return null |
| 69 | }) |
| 70 | .filter(notEmpty) |
| 71 | if (remoteIds.length === 0) |
| 72 | C.toastImpossible(`Zero remoteIds - is something wrong with the SQL query?`) |
| 73 | return { |
| 74 | localId: template.id, |
| 75 | name: template.name, |
| 76 | css: template.css, |
| 77 | templateType: template.templateType, |
| 78 | remoteIds, |
| 79 | fields: template.fields.map((x) => x.name), |
| 80 | } satisfies EditRemoteTemplate |
| 81 | } |
| 82 | |
| 83 | export const templateCollectionMethods = { |
| 84 | async upsertTemplate(template: Template) { |
no outgoing calls
no test coverage detected