gosora/common/subscription.go
Azareal a7fec11170 IP Search now searches profile replies.
Added the subscription and attachment stores.

Refactored the routes to use the new subscription and attachment stores.
Fixed up the buttons on the profile comments for Cosora.
Made various enhancements to Cosora.
Renamed routePanel to routePanelDashboard.
Changed routeCreateTopicSubmit into an upload action and moved it into /routes/topic.go and refactored some of the redundant bits away.
2018-01-22 08:15:45 +00:00

28 lines
775 B
Go

package common
import "database/sql"
import "../query_gen/lib"
var Subscriptions SubscriptionStore
// ? Should we have a subscription store for each zone? topic, forum, etc?
type SubscriptionStore interface {
Add(uid int, elementID int, elementType string) error
}
type DefaultSubscriptionStore struct {
add *sql.Stmt
}
func NewDefaultSubscriptionStore() (*DefaultSubscriptionStore, error) {
acc := qgen.Builder.Accumulator()
return &DefaultSubscriptionStore{
add: acc.Insert("activity_subscriptions").Columns("user, targetID, targetType, level").Fields("?,?,?,2").Prepare(),
}, acc.FirstError()
}
func (store *DefaultSubscriptionStore) Add(uid int, elementID int, elementType string) error {
_, err := store.add.Exec(uid, elementID, elementType)
return err
}