2024-11-13 22:09:18 +03:00

24 lines
374 B
Go

package checkRole
import (
"context"
db_repo "enshi/db/go_queries"
"enshi/db_connection"
)
func IsOwnerOfThePost(userId int64, postId int64) (bool, error) {
post, err :=
db_repo.New(db_connection.Dbx).
GetPostsByPostId(context.Background(), postId)
if err != nil {
return false, err
}
if post.UserID != userId {
return false, nil
}
return true, nil
}