MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / ApiCreateNodeToDb

Function ApiCreateNodeToDb

mapper/node.go:12–45  ·  view source on GitHub ↗
(publisherId string, node *drip.Node, client *ent.Client)

Source from the content-addressed store, hash-verified

10)
11
12func ApiCreateNodeToDb(publisherId string, node *drip.Node, client *ent.Client) (*ent.NodeCreate, error) {
13 newNode := client.Node.Create()
14 newNode.SetPublisherID(publisherId)
15 if node.Description != nil {
16 newNode.SetDescription(*node.Description)
17 }
18 if node.Id != nil {
19 newNode.SetID(*node.Id)
20 newNode.SetNormalizedID(normalizeNodeID(*node.Id))
21 }
22 if node.Author != nil {
23 newNode.SetAuthor(*node.Author)
24 }
25 if node.License != nil {
26 newNode.SetLicense(*node.License)
27 }
28 if node.Name != nil {
29 newNode.SetName(*node.Name)
30 }
31 if node.Category != nil {
32 newNode.SetCategory(*node.Category)
33 }
34 if node.Tags != nil {
35 newNode.SetTags(*node.Tags)
36 }
37 if node.Repository != nil {
38 newNode.SetRepositoryURL(*node.Repository)
39 }
40 if node.Icon != nil {
41 newNode.SetIconURL(*node.Icon)
42 }
43
44 return newNode, nil
45}
46
47func ApiUpdateNodeToUpdateFields(nodeID string, node *drip.Node, client *ent.Client) *ent.NodeUpdateOne {
48 update := client.Node.UpdateOneID(nodeID)

Callers 1

CreateNodeMethod · 0.92

Calls 13

normalizeNodeIDFunction · 0.85
CreateMethod · 0.45
SetPublisherIDMethod · 0.45
SetDescriptionMethod · 0.45
SetIDMethod · 0.45
SetNormalizedIDMethod · 0.45
SetAuthorMethod · 0.45
SetLicenseMethod · 0.45
SetNameMethod · 0.45
SetCategoryMethod · 0.45
SetTagsMethod · 0.45
SetRepositoryURLMethod · 0.45

Tested by

no test coverage detected