MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / UpdateCollection

Method UpdateCollection

component/collection.go:152–164  ·  view source on GitHub ↗
(ctx context.Context, input types.CreateCollectionReq)

Source from the content-addressed store, hash-verified

150}
151
152func (cc *CollectionComponent) UpdateCollection(ctx context.Context, input types.CreateCollectionReq) (*database.Collection, error) {
153 collection, err := cc.cs.GetCollection(ctx, input.ID)
154 if err != nil {
155 return nil, fmt.Errorf("cannot find collection to update, %w", err)
156 }
157 collection.Name = input.Name
158 collection.Nickname = input.Nickname
159 collection.Description = input.Description
160 collection.Private = input.Private
161 collection.Theme = input.Theme
162 collection.UpdatedAt = time.Now()
163 return cc.cs.UpdateCollection(ctx, *collection)
164}
165
166func (cc *CollectionComponent) DeleteCollection(ctx context.Context, id int64, userName string) error {
167 // find by user name

Callers

nothing calls this directly

Calls 1

GetCollectionMethod · 0.45

Tested by

no test coverage detected