Renamed index to position for Post model and API
This commit is contained in:
+13
-13
@@ -79,12 +79,12 @@ func (r *MutationResolver) AddPost(ctx context.Context, args struct{ Input *Post
|
||||
}
|
||||
|
||||
change.Submit("Post", "add", user.ID, post.ID, map[string]interface{}{
|
||||
"logId": post.LogID,
|
||||
"time": post.Time,
|
||||
"kind": post.Kind,
|
||||
"nick": post.Nick,
|
||||
"text": post.Text,
|
||||
"index": post.Index,
|
||||
"logId": post.LogID,
|
||||
"time": post.Time,
|
||||
"kind": post.Kind,
|
||||
"nick": post.Nick,
|
||||
"text": post.Text,
|
||||
"position": post.Position,
|
||||
})
|
||||
|
||||
go log.UpdateCharacters()
|
||||
@@ -142,8 +142,8 @@ func (r *MutationResolver) EditPost(ctx context.Context, args struct{ Input *Pos
|
||||
|
||||
// PostMoveInput is an input
|
||||
type PostMoveInput struct {
|
||||
ID string
|
||||
TargetIndex int32
|
||||
ID string
|
||||
ToPosition int32
|
||||
}
|
||||
|
||||
// MovePost resolves the movePost mutation
|
||||
@@ -158,14 +158,14 @@ func (r *MutationResolver) MovePost(ctx context.Context, args struct{ Input *Pos
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = post.Move(int(args.Input.TargetIndex))
|
||||
err = post.Move(int(args.Input.ToPosition))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
change.Submit("Post", "move", user.ID, post.ID, map[string]interface{}{
|
||||
"logId": post.LogID,
|
||||
"targetIndex": args.Input.TargetIndex,
|
||||
"targetIndex": args.Input.ToPosition,
|
||||
})
|
||||
|
||||
return &PostResolver{P: post}, nil
|
||||
@@ -227,7 +227,7 @@ func (r *PostResolver) Text() string {
|
||||
return r.P.Text
|
||||
}
|
||||
|
||||
// Index resolves Post.text
|
||||
func (r *PostResolver) Index() int32 {
|
||||
return int32(r.P.Index)
|
||||
// Position resolves Post.text
|
||||
func (r *PostResolver) Position() int32 {
|
||||
return int32(r.P.Position)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user