// UpdateManyRoleProfiles allows many role profiles to be added at the // same time func UpdateManyRoleProfiles( siteID int64, roleID int64, ems []RoleProfileType, ) ( int, error, ) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() for _, m := range ems { status, err := m.insert(tx, siteID, roleID) if err != nil { return status, err } } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } go PurgeCache(h.ItemTypes[h.ItemTypeRole], roleID) return http.StatusOK, nil }
// UpdateLastNotified updates a watcher according to the last time that watcher // triggered a notification. The purpose is to record any contact so that we // can avoid multiple notifications for a given item func (m *WatcherType) UpdateLastNotified() (int, error) { tx, err := h.GetTransaction() if err != nil { glog.Error(err) return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` UPDATE watchers SET last_notified = NOW() WHERE watcher_id = $1`, m.ID, ) if err != nil { glog.Error(err) tx.Rollback() return http.StatusInternalServerError, err } err = tx.Commit() if err != nil { glog.Error(err) return http.StatusInternalServerError, err } PurgeCache(h.ItemTypes[h.ItemTypeWatcher], m.ID) return http.StatusOK, nil }
// Update saves a single participant func (m *HuddleParticipantType) Update( siteID int64, huddleID int64, ) ( int, error, ) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() status, err := m.insert(tx, siteID, huddleID) if err != nil { return status, err } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Delete removes an ignore func (m *IgnoreType) Delete() (int, error) { status, err := m.Validate() if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() // Lack of error checking, it can only fail if it has been deleted already // and our answer "OK" remains the same if it exists after this action. tx.Exec(`--Delete Ignore DELETE FROM ignores WHERE profile_id = $1 AND item_type_id = $2 AND item_id = $3`, m.ProfileID, m.ItemTypeID, m.ItemID, ) if err == nil { tx.Commit() } return http.StatusOK, nil }
// Delete removes an update option record for a specific user. Generally this // will be unnecessary unless a user needs to clear their preferences completely // and return to the defaults. func (m *UpdateOptionType) Delete() (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` DELETE FROM update_options WHERE profile_id = $1 AND update_type_id = $2`, m.ProfileID, m.UpdateTypeID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Delete failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// UpdateManyAttributes updates many attributes at once func UpdateManyAttributes( itemTypeID int64, itemID int64, ems []AttributeType, ) ( int, error, ) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() for _, m := range ems { status, err := m.upsert(tx, itemTypeID, itemID) if err != nil { return status, err } } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Delete removes a microcosm from the database func (m *MicrocosmType) Delete() (int, error) { // Delete resource tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(`-- Delete Microcosm UPDATE microcosms SET is_deleted = true WHERE microcosm_id = $1`, m.ID, ) if err != nil { tx.Rollback() return http.StatusInternalServerError, fmt.Errorf("Delete failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.ID) return http.StatusOK, nil }
// UpdateManyHuddleParticipants saves many participants func UpdateManyHuddleParticipants( siteID int64, huddleID int64, ems []HuddleParticipantType, ) ( int, error, ) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() for _, m := range ems { status, err := m.insert(tx, siteID, huddleID) if err != nil { return status, err } } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf(fmt.Sprintf("Transaction failed: %+v", err)) } go PurgeCache(h.ItemTypes[h.ItemTypeHuddle], huddleID) return http.StatusOK, nil }
// Delete removes a participant from a huddle func (m *HuddleType) Delete(siteID int64, profileID int64) (int, error) { // Synonym for removing participant. If all participants are removed then // this will physically delete the huddle tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` DELETE FROM huddle_profiles WHERE huddle_id = $1 AND profile_id = $2`, m.ID, profileID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Delete failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeHuddle], m.ID) return http.StatusOK, nil }
// Update saves the changes to an attachment func (m *AttachmentType) Update() (int, error) { tx, err := h.GetTransaction() if err != nil { glog.Errorf("h.GetTransaction() %+v", err) return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` UPDATE attachments SET created = $1 WHERE attachment_id = $2`, m.Created, m.AttachmentID, ) if err != nil { glog.Errorf("tx.Exec(%v, %d) %+v", m.Created, m.AttachmentID, err) return http.StatusInternalServerError, fmt.Errorf("Attachment update failed") } err = tx.Commit() if err != nil { glog.Errorf("tx.Commit() %+v", err) return http.StatusInternalServerError, fmt.Errorf("Transaction failed") } return http.StatusOK, nil }
// DeleteMenu removes the entire menu func DeleteMenu(siteID int64) (int, error) { tx, err := h.GetTransaction() if err != nil { glog.Errorf("h.GetTransaction() %+v", err) return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` DELETE FROM menus WHERE site_id = $1`, siteID, ) if err != nil { glog.Errorf("stmt1.Exec(%d) %+v", siteID, err) return http.StatusInternalServerError, fmt.Errorf("Failed to delete existing menu") } err = tx.Commit() if err != nil { glog.Errorf("tx.Commit() %+v", err) return http.StatusInternalServerError, fmt.Errorf("Transaction failed") } go PurgeCache(h.ItemTypes[h.ItemTypeSite], siteID) return http.StatusOK, nil }
// Update saves the ignore to the database func (m *IgnoreType) Update() (int, error) { status, err := m.Validate() if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() // Lack of error checking, it can only fail if it has been inserted already // and our answer "OK" remains the same if it exists after this action. tx.Exec(`--Create Ignore INSERT INTO ignores ( profile_id, item_type_id, item_id ) VALUES ( $1, $2, $3 )`, m.ProfileID, m.ItemTypeID, m.ItemID, ) if err == nil { tx.Commit() } return http.StatusOK, nil }
// Delete nukes an event func (m *EventType) Delete() (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` UPDATE events SET is_deleted = true ,is_visible = false WHERE event_id = $1`, m.ID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Delete failed: %v", err.Error()) } err = DecrementMicrocosmItemCount(tx, m.MicrocosmID) if err != nil { return http.StatusInternalServerError, err } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeEvent], m.ID) PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.MicrocosmID) return http.StatusOK, nil }
// Insert creates the watcher func (m *WatcherType) insert(imported bool) (int, error) { status, err := m.validate(imported) if err != nil { glog.Error(err) return status, err } tx, err := h.GetTransaction() if err != nil { glog.Error(err) return http.StatusInternalServerError, err } defer tx.Rollback() var insertID int64 err = tx.QueryRow(` INSERT INTO watchers ( profile_id ,item_type_id ,item_id ,send_email ,send_sms ) VALUES ( $1, $2, $3, $4, $5 ) RETURNING watcher_id`, m.ProfileID, m.ItemTypeID, m.ItemID, m.SendEmail, m.SendSMS, ).Scan( &insertID, ) if err != nil { glog.Error(err) return http.StatusInternalServerError, fmt.Errorf("Error inserting data and returning ID: %+v", err) } m.ID = insertID err = tx.Commit() if err != nil { glog.Error(err) return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeWatcher], m.ID) return http.StatusOK, nil }
// Insert creates a communication option to the database func (m *UpdateOptionType) Insert() (int, error) { status, err := m.Validate() if err != nil { return status, err } // Check that a corresponding profile_options record exists, // otherwise profile_id constraint will fail. // TODO(lewi): check receive_email doesn't contradict // profile_options.email_updates _, status, err = GetProfileOptions(m.ProfileID) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Insert of update preference failed: %v", err.Error()) } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` INSERT INTO update_options ( profile_id ,update_type_id ,send_email ,send_sms ) VALUES ( $1, $2, $3, $4 )`, m.ProfileID, m.UpdateTypeID, m.SendEmail, m.SendSMS, ) if err != nil { tx.Rollback() return http.StatusInternalServerError, fmt.Errorf("Insert of update option failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
func (m *ConversationType) insert(siteID int64, profileID int64) (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() var insertID int64 err = tx.QueryRow(`--Create Conversation INSERT INTO conversations ( microcosm_id, title, created, created_by, view_count, is_deleted, is_moderated, is_open, is_sticky ) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9 ) RETURNING conversation_id`, m.MicrocosmID, m.Title, m.Meta.Created, m.Meta.CreatedByID, m.ViewCount, m.Meta.Flags.Deleted, m.Meta.Flags.Moderated, m.Meta.Flags.Open, m.Meta.Flags.Sticky, ).Scan( &insertID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf( "Error inserting data and returning ID: %v", err.Error(), ) } m.ID = insertID err = IncrementMicrocosmItemCount(tx, m.MicrocosmID) if err != nil { return http.StatusInternalServerError, err } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeConversation], m.ID) PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.MicrocosmID) return http.StatusOK, nil }
// Update saves changes to to a file func (f *FileMetadataType) Update() (int, error) { status, err := f.Validate() if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` UPDATE attachment_meta SET created = $1 ,file_size = $2 ,file_sha1 = $3 ,mime_type = $4 ,width = $5 ,height = $6 ,thumbnail_width = $7 ,thumbnail_height = $8 ,attach_count = $9 ,file_name = $10 ,file_ext = $11 WHERE attachment_meta_id = $12`, f.Created, f.FileSize, f.FileHash, f.MimeType, f.Width, f.Height, f.ThumbnailWidth, f.ThumbnailHeight, f.AttachCount, f.FileName, f.FileExt, f.AttachmentMetaID, ) if err != nil { tx.Rollback() return http.StatusInternalServerError, fmt.Errorf("Could not update attachment metadata: %+v", err) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %+v", err) } return http.StatusOK, nil }
// Update saves the current version of the profile to the database func (m *ProfileType) Update() (int, error) { status, err := m.Validate(true) if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Could not start transaction: %v", err.Error()) } defer tx.Rollback() _, err = tx.Exec(`--Update Profile UPDATE profiles SET profile_name = $2 ,gender = $3 ,is_visible = $4 ,style_id = $5 ,item_count = $6 ,comment_count = $7 ,last_active = $8 ,avatar_url = $9 ,avatar_id = $10 WHERE profile_id = $1`, m.ID, m.ProfileName, m.GenderNullable, m.Visible, m.StyleID, m.ItemCount, m.CommentCount, m.LastActive, m.AvatarURLNullable, m.AvatarIDNullable, ) if err != nil { tx.Rollback() return http.StatusInternalServerError, fmt.Errorf("Update of profile failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeProfile], m.ID) return http.StatusOK, nil }
// Insert saves the criterion to the database func (m *RoleCriterionType) Insert(roleID int64) (int, error) { status, err := m.Validate(false) if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() var insertID int64 err = tx.QueryRow(` INSERT INTO criteria ( role_id, or_group, profile_column, key, type, predicate, value ) VALUES ( $1, $2, $3, $4, $5, $6, $7 ) RETURNING criteria_id`, roleID, m.OrGroup, m.ProfileColumnNullable, m.AttrKeyNullable, m.Type, m.Predicate, m.ValueString, ).Scan( &insertID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Error executing insert: %v", err.Error()) } m.ID = insertID err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } go PurgeCache(h.ItemTypes[h.ItemTypeRole], roleID) return http.StatusOK, nil }
// Update saves changes to the microcosm func (m *MicrocosmType) Update() (int, error) { status, err := m.Validate(true, false) if err != nil { return status, err } // Update resource tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(`-- Update Microcosm UPDATE microcosms SET site_id = $2, visibility = $3, title = $4, description = $5, edited = $6, edited_by = $7, edit_reason = $8 WHERE microcosm_id = $1`, m.ID, m.SiteID, m.Visibility, m.Title, m.Description, m.Meta.EditedNullable, m.Meta.EditedByNullable, m.Meta.EditReason, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Update failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.ID) return http.StatusOK, nil }
// UpdateUnreadHuddleCount updates the unread huddle count func UpdateUnreadHuddleCount(profileID int64) { tx, err := h.GetTransaction() if err != nil { glog.Error(err) return } defer tx.Rollback() updateUnreadHuddleCount(tx, profileID) err = tx.Commit() if err != nil { glog.Error(err) return } }
// Update saves changes to the criterion to the database func (m *RoleCriterionType) Update(roleID int64) (int, error) { status, err := m.Validate(true) if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` UPDATE criteria SET or_group = $2 ,profile_column = $3 ,key = $4 ,type = $5 ,predicate = $6 ,value = $7 WHERE criteria_id = $1`, m.ID, m.OrGroup, m.ProfileColumnNullable, m.AttrKeyNullable, m.Type, m.Predicate, m.ValueString, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Error executing insert: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } go PurgeCache(h.ItemTypes[h.ItemTypeRole], roleID) return http.StatusOK, nil }
// Insert creates a user func (m *UserType) Insert() (int, error) { status, err := m.Validate(false) if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Could not start transaction: %v", err.Error()) } defer tx.Rollback() var insertID int64 // TODO(buro9): language constraints, password flow err = tx.QueryRow(` INSERT INTO users ( email, created, language, is_banned, password, password_date ) VALUES ( $1, NOW(), $2, false, $3, NOW() ) RETURNING user_id`, m.Email, m.Language, m.Password, ).Scan( &insertID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Error inserting data and returning ID: %+v", err) } m.ID = insertID err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Update updates a conversation func (m *ConversationType) Update(siteID int64, profileID int64) (int, error) { status, err := m.Validate(siteID, profileID, true, false) if err != nil { return status, err } tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(`--Update Conversation UPDATE conversations SET microcosm_id = $2, title = $3, edited = $4, edited_by = $5, edit_reason = $6 WHERE conversation_id = $1`, m.ID, m.MicrocosmID, m.Title, m.Meta.EditedNullable, m.Meta.EditedByNullable, m.Meta.EditReason, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Update failed: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeConversation], m.ID) PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.MicrocosmID) return http.StatusOK, nil }
// insert saves the microcosm to the database func (m *MicrocosmType) insert() (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() var insertID int64 err = tx.QueryRow(`-- Create Microcosm INSERT INTO microcosms ( site_id, visibility, title, description, created, created_by, owned_by ) VALUES ( $1, $2, $3, $4, $5, $6, $7 ) RETURNING microcosm_id`, m.SiteID, m.Visibility, m.Title, m.Description, m.Meta.Created, m.Meta.CreatedByID, m.OwnedByID, ).Scan( &insertID, ) if err != nil { return http.StatusInternalServerError, fmt.Errorf("Error inserting data and returning ID: %+v", err) } m.ID = insertID err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } PurgeCache(h.ItemTypes[h.ItemTypeMicrocosm], m.ID) return http.StatusOK, nil }
// DeleteManyAttributes removes many attributes func DeleteManyAttributes( itemTypeID int64, itemID int64, ms []AttributeType, ) ( int, error, ) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() for _, m := range ms { var ( attributeID int64 status int ) if m.ID > 0 { attributeID = m.ID } else { attributeID, status, err = GetAttributeID(itemTypeID, itemID, m.Key) if err != nil { return status, err } } status, err := m.delete(tx, attributeID) if err != nil { return status, err } } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Delete removes an attendee func (m *AttendeeType) Delete(siteID int64) (int, error) { event, status, err := GetEvent(siteID, m.EventID, 0) if err != nil { glog.Errorf("GetEvent(%d, %d, 0) %+v", siteID, m.EventID, err) return status, err } // Connect to DB tx, err := h.GetTransaction() if err != nil { glog.Errorf("h.GetTransaction() %+v", err) return http.StatusInternalServerError, err } defer tx.Rollback() _, err = tx.Exec(` DELETE FROM attendees WHERE attendee_id = $1`, m.ID, ) if err != nil { glog.Errorf("tx.Exec(%d) %+v", m.ID, err) return http.StatusInternalServerError, fmt.Errorf("Delete failed") } status, err = event.UpdateAttendees(tx) if err != nil { glog.Errorf("event.UpdateAttendees(tx) %+v", err) return status, err } err = tx.Commit() if err != nil { glog.Errorf("tx.Commit() %+v", err) return http.StatusInternalServerError, fmt.Errorf("Transaction failed") } go PurgeCache(h.ItemTypes[h.ItemTypeAttendee], m.ID) go PurgeCache(h.ItemTypes[h.ItemTypeEvent], m.EventID) return http.StatusOK, nil }
// Delete removes a single attribute func (m *AttributeType) Delete() (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() status, err := m.delete(tx, m.ID) if err != nil { return status, err } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Update updates a single attribute func (m *AttributeType) Update(itemTypeID int64, itemID int64) (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, err } defer tx.Rollback() status, err := m.upsert(tx, itemTypeID, itemID) if err != nil { return status, err } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } return http.StatusOK, nil }
// Update saves the updated options for a profile func (m *ProfileOptionType) Update() (int, error) { tx, err := h.GetTransaction() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Could not start transaction: %v", err.Error()) } defer tx.Rollback() _, err = tx.Exec(` UPDATE profile_options SET show_dob_year = $2 ,show_dob_date = $3 ,send_email = $4 ,send_sms = $5 ,is_discouraged = $6 WHERE profile_id = $1`, m.ProfileID, m.ShowDOBYear, m.ShowDOB, m.SendEMail, m.SendSMS, m.IsDiscouraged, ) if err != nil { tx.Rollback() return http.StatusInternalServerError, fmt.Errorf("Error inserting data: %v", err.Error()) } err = tx.Commit() if err != nil { return http.StatusInternalServerError, fmt.Errorf("Transaction failed: %v", err.Error()) } go PurgeCacheByScope(c.CacheOptions, h.ItemTypes[h.ItemTypeProfile], m.ProfileID) return http.StatusOK, nil }