This commit is contained in:
inhosin 2019-09-19 10:14:22 +03:00
parent 61b976259a
commit d6387c3528
9 changed files with 69 additions and 81 deletions

View file

@ -13,7 +13,7 @@ import (
// Get returns a Group
//
// Expects a `{name}` url variable
// in the route: `/api/group/:name`
// in the route: `/group/:name`
func Get(c *gin.Context) {
name := c.Param("name")
if name == "" {
@ -31,7 +31,7 @@ func Get(c *gin.Context) {
return
}
url := handlers.GetFullHostName() + "/activity/group/" + group.Slug
url := handlers.GetFullHostName() + "/group/" + group.Id
actor := activitypub.NewPerson(url)
actor.PreferredUsername = group.Name
actor.Name = group.Name

View file

@ -8,8 +8,8 @@ import (
)
type createGroupRequest struct {
Name string `json:"name"`
Note string `json:"note"`
Name string `json:"name"`
Status string `json:"status"`
}
type createGroupResponse struct {
@ -21,8 +21,7 @@ func Create(c *gin.Context) {
var body createGroupRequest
_ = c.BindJSON(&body)
db := data.GetDB()
slug, err := models.PutGroup(db, body.Name, body.Note)
slug, err := models.PutGroup(data.GetDB(), body.Name, body.Status)
if err != nil {
c.String(http.StatusInternalServerError, err.Error())
return