openboard icon indicating copy to clipboard operation
openboard copied to clipboard

Post Service Queries: Make Improvements Similar to Those made with User Service Queries

Open codegold79 opened this issue 5 years ago • 0 comments

The post service returns responses (y) whose values are copied from the request (x). Instead of copying, the response values should come from another database query. Add those queries.

The upsert queries in post are also using db.Prepare() when it is not necessary. See http://go-database-sql.org/prepared.html for more information. Use instead db.Exec() similar to what was used in upsertRole() method in the qryuser.go.

When finding posts, the items returned should be limited. Include limit and lapse in the select query for finding posts, similar to how user posts are found.

A/C

  • [x] blocked by #85
  • method upsertType()
    • [ ] doesn't need a query prepared with db.Prepare().
    • [ ] instead of setting y.Name to x.Name, should query the database for the value of y.Name
  • method upsertPost()
    • [ ] instead of setting the fields in y with the fields from x, query the database for the needed information
    • [ ] doesn't need a query prepared with db.Prepare().
  • can follow what was done for qryuser.go in upsertUser() in PR #86
  • method findPosts()
    • [ ] include limit and lapse in the select query, similar to how it is done for finding users.

codegold79 avatar Aug 06 '20 01:08 codegold79