mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-14 06:06:15 +01:00
Fix inconsistency of the latest commit
This commit is contained in:
parent
963e392cea
commit
c134becb61
3 changed files with 20 additions and 4 deletions
|
@ -33,8 +33,16 @@ func (rt *_router) GetComments(w http.ResponseWriter, r *http.Request, ps httpro
|
|||
return
|
||||
}
|
||||
|
||||
// get limits, or use defaults
|
||||
start_index, limit, err := helpers.GetLimits(r.URL.Query())
|
||||
|
||||
if err != nil {
|
||||
helpers.SendBadRequest(w, "Invalid start_index or limit", rt.baseLogger)
|
||||
return
|
||||
}
|
||||
|
||||
// get the user's comments
|
||||
success, comments, err := rt.db.GetComments(uid, photo_id, ctx.Auth.GetUserID())
|
||||
success, comments, err := rt.db.GetComments(uid, photo_id, ctx.Auth.GetUserID(), start_index, limit)
|
||||
|
||||
if err != nil {
|
||||
helpers.SendInternalError(err, "Database error: GetComments", w, rt.baseLogger)
|
||||
|
|
|
@ -23,13 +23,21 @@ func (rt *_router) GetLikes(w http.ResponseWriter, r *http.Request, ps httproute
|
|||
return
|
||||
}
|
||||
|
||||
// get limits, or use defaults
|
||||
start_index, limit, err := helpers.GetLimits(r.URL.Query())
|
||||
|
||||
if err != nil {
|
||||
helpers.SendBadRequest(w, "Invalid start_index or limit", rt.baseLogger)
|
||||
return
|
||||
}
|
||||
|
||||
// send 404 if the user does not exist
|
||||
if !helpers.VerifyUserOrNotFound(rt.db, uid, w, rt.baseLogger) {
|
||||
return
|
||||
}
|
||||
|
||||
// get the user's likes
|
||||
success, likes, err := rt.db.GetPhotoLikes(uid, photo_id, ctx.Auth.GetUserID())
|
||||
success, likes, err := rt.db.GetPhotoLikes(uid, photo_id, ctx.Auth.GetUserID(), start_index, limit)
|
||||
|
||||
if err != nil {
|
||||
helpers.SendInternalError(err, "Database error: GetLikes", w, rt.baseLogger)
|
||||
|
|
|
@ -60,14 +60,14 @@ type AppDatabase interface {
|
|||
PostPhoto(uid string) (DBTransaction, int64, error)
|
||||
DeletePhoto(uid string, photo int64) (bool, error)
|
||||
|
||||
GetPhotoLikes(uid string, photo int64, requesting_uid string) (QueryResult, *[]structures.UIDName, error)
|
||||
GetPhotoLikes(uid string, photo int64, requesting_uid string, start_index int, offset int) (QueryResult, *[]structures.UIDName, error)
|
||||
LikePhoto(uid string, photo int64, liker_uid string) (QueryResult, error)
|
||||
UnlikePhoto(uid string, photo int64, liker_uid string) (QueryResult, error)
|
||||
|
||||
GetUserProfile(uid string) (QueryResult, *structures.UserProfile, error)
|
||||
GetUserStream(uid string, start_index int, limit int) (*[]structures.Photo, error)
|
||||
|
||||
GetComments(uid string, photo_id int64, requesting_uid string) (QueryResult, *[]structures.Comment, error)
|
||||
GetComments(uid string, photo_id int64, requesting_uid string, start_index int, offset int) (QueryResult, *[]structures.Comment, error)
|
||||
PostComment(uid string, photo_id int64, comment_user string, comment string) (QueryResult, error)
|
||||
DeleteComment(uid string, photo_id int64, comment_id int64) (QueryResult, error)
|
||||
GetCommentOwner(uid string, photo_id int64, comment_id int64) (QueryResult, string, error)
|
||||
|
|
Loading…
Reference in a new issue