Add routes for creating and removing subscriptions

This commit is contained in:
kolaente 2021-02-13 17:23:25 +01:00
parent eed15af70f
commit 3d94b489cd
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 10 additions and 1 deletions

View File

@ -41,7 +41,7 @@ type Subscription struct {
EntityType SubscriptionEntityType `xorm:"index not null" json:"-"`
Entity string `xorm:"-" json:"-" param:"entity"`
// The id of the entity to subscribe to.
EntityID int64 `xorm:"bigint index not null" json:"entity_id"`
EntityID int64 `xorm:"bigint index not null" json:"entity_id" param:"entityID"`
// The user who made this subscription
User *user.User `xorm:"-" json:"user"`

View File

@ -512,6 +512,15 @@ func registerAPIRoutes(a *echo.Group) {
a.DELETE("/teams/:team/members/:user", teamMemberHandler.DeleteWeb)
a.POST("/teams/:team/members/:user/admin", teamMemberHandler.UpdateWeb)
// Subscriptions
subscriptionHandler := &handler.WebHandler{
EmptyStruct: func() handler.CObject {
return &models.Subscription{}
},
}
a.PUT("/subscriptions/:entity/:entityID", subscriptionHandler.CreateWeb)
a.DELETE("/subscriptions/:entity/:entityID", subscriptionHandler.DeleteWeb)
// Migrations
m := a.Group("/migration")