MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / domainToEditRemote

Function domainToEditRemote

app/src/sqlite/template.ts:64–81  ·  view source on GitHub ↗
(template: Template, nook?: NookId)

Source from the content-addressed store, hash-verified

62}
63
64function 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
83export const templateCollectionMethods = {
84 async upsertTemplate(template: Template) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected