new guestbook functions
This commit is contained in:
		
							parent
							
								
									36bfde1e4d
								
							
						
					
					
						commit
						6c18752230
					
				@ -33,6 +33,7 @@ func (app *application) routes() http.Handler {
 | 
				
			|||||||
    mux.Handle("GET /guestbooks/{id}/dashboard", protected.ThenFunc(app.getGuestbookDashboard))
 | 
					    mux.Handle("GET /guestbooks/{id}/dashboard", protected.ThenFunc(app.getGuestbookDashboard))
 | 
				
			||||||
    mux.Handle("GET /guestbooks/{id}/dashboard/comments", protected.ThenFunc(app.getGuestbookComments))
 | 
					    mux.Handle("GET /guestbooks/{id}/dashboard/comments", protected.ThenFunc(app.getGuestbookComments))
 | 
				
			||||||
    mux.Handle("GET /guestbooks/{id}/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate))
 | 
					    mux.Handle("GET /guestbooks/{id}/comments/create", protected.ThenFunc(app.getGuestbookCommentCreate))
 | 
				
			||||||
 | 
					    mux.Handle("GET /guestbooks/{id}/dashboard/comments/queue", protected.ThenFunc(app.getCommentQueue))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return standard.Then(mux)
 | 
					    return standard.Then(mux)
 | 
				
			||||||
 | 
				
			|||||||
@ -102,3 +102,14 @@ func (m *GuestbookCommentModel) GetQueue(guestbookId int64) ([]GuestbookComment,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return comments, nil
 | 
					    return comments, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (m *GuestbookCommentModel) UpdateComment(comment *GuestbookComment) error {
 | 
				
			||||||
 | 
					    stmt := `UPDATE guestbook_comments (CommentText, PageUrl, IsPublished, IsDeleted)
 | 
				
			||||||
 | 
							VALUES (?, ?, ?, ?)
 | 
				
			||||||
 | 
							WHERE Id = ?`
 | 
				
			||||||
 | 
					    _, err := m.DB.Exec(stmt, comment.CommentText, comment.PageUrl, comment.IsPublished, comment.IsDeleted, comment.ID)
 | 
				
			||||||
 | 
					    if err != nil {
 | 
				
			||||||
 | 
						return err
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user