aboutsummaryrefslogtreecommitdiffstats
path: root/golang/api/handlers/entities.go
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-09 22:41:45 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-09 22:41:45 -0700
commit518f0efcbea91949e1cacc5c0e5991e3b98e97c0 (patch)
treec4d9a024253b6a17840f66bb9dbd2a6a4a1bcfd3 /golang/api/handlers/entities.go
parent0f3bbc214fa584315d5f7a90a5c1d7e54794420a (diff)
downloadfatcat-518f0efcbea91949e1cacc5c0e5991e3b98e97c0.tar.gz
fatcat-518f0efcbea91949e1cacc5c0e5991e3b98e97c0.zip
start refactoring handlers into separate directory
Diffstat (limited to 'golang/api/handlers/entities.go')
-rw-r--r--golang/api/handlers/entities.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/golang/api/handlers/entities.go b/golang/api/handlers/entities.go
new file mode 100644
index 00000000..75c8b72b
--- /dev/null
+++ b/golang/api/handlers/entities.go
@@ -0,0 +1,43 @@
+
+package handlers
+
+import (
+ //"net/http"
+
+ "github.com/go-pg/pg"
+ "github.com/go-openapi/runtime/middleware"
+
+ //"git.archive.org/bnewbold/fatcat/golang/gen/models"
+ "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
+)
+
+func NewGetCreatorIDHandler(db *pg.DB) operations.GetCreatorIDHandler {
+ return &getCreatorID{db: db}
+}
+
+type getCreatorID struct {
+ db *pg.DB
+}
+
+func (d *getCreatorID) Handle(params operations.GetCreatorIDParams) middleware.Responder {
+ // "get or 404" using params.ID. join creator_ident and creator_rev.
+ // populate result data
+ // return that
+ return middleware.NotImplemented("operation .GetCreatorID has not yet been implemented. Coming soon!")
+}
+
+
+
+func NewPostCreatorHandler(db *pg.DB) operations.PostCreatorHandler {
+ return &postCreator{db: db}
+}
+
+type postCreator struct {
+ db *pg.DB
+}
+
+func (d *postCreator) Handle(params operations.PostCreatorParams) middleware.Responder {
+ // get-or-create editgroup based on current editor (session)
+ // insert new rev, ident, and edit
+ return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
+}