summaryrefslogtreecommitdiffstats
path: root/golang/api
diff options
context:
space:
mode:
Diffstat (limited to 'golang/api')
-rw-r--r--golang/api/handlers/editing.go104
-rw-r--r--golang/api/handlers/entities.go13
2 files changed, 117 insertions, 0 deletions
diff --git a/golang/api/handlers/editing.go b/golang/api/handlers/editing.go
new file mode 100644
index 00000000..b0c006cb
--- /dev/null
+++ b/golang/api/handlers/editing.go
@@ -0,0 +1,104 @@
+
+package handlers
+
+import (
+ "github.com/go-pg/pg"
+ //"github.com/go-openapi/swag"
+ "github.com/go-openapi/runtime/middleware"
+ //log "github.com/sirupsen/logrus"
+
+ //"git.archive.org/bnewbold/fatcat/golang/gen/models"
+ "git.archive.org/bnewbold/fatcat/golang/gen/restapi/operations"
+)
+
+type Editor struct {
+ Id int64
+ Username string
+ IsAdmin bool
+ ActiveEditgroupId int64
+ ActiveEditgroup *Editgroup
+}
+
+type Editgroup struct {
+ Id int64
+ ExtraJson string
+ EditorId int64
+ Editor *Editor
+ Description string
+}
+
+type Changelog struct {
+ Id int64
+ EditgroupId int64
+ Editgroup *Editgroup
+ Timestamp string // XXX: timestamp
+}
+
+func GetOrCreateEditgroup() Editgroup {
+ // XXX
+ eg := Editgroup{}
+ return eg
+}
+
+func NewGetEditorUsernameHandler(db *pg.DB) operations.GetEditorUsernameHandler {
+ return &getEditorUsername{db: db}
+}
+type getEditorUsername struct {
+ db *pg.DB
+}
+func (d *getEditorUsername) Handle(params operations.GetEditorUsernameParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
+}
+
+
+func NewGetEditorUsernameChangelogHandler(db *pg.DB) operations.GetEditorUsernameChangelogHandler {
+ return &getEditorUsernameChangelog{db: db}
+}
+type getEditorUsernameChangelog struct {
+ db *pg.DB
+}
+func (d *getEditorUsernameChangelog) Handle(params operations.GetEditorUsernameChangelogParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
+}
+
+func NewGetEditgroupIDHandler(db *pg.DB) operations.GetEditgroupIDHandler {
+ return &getEditgroupID{db: db}
+}
+type getEditgroupID struct {
+ db *pg.DB
+}
+func (d *getEditgroupID) Handle(params operations.GetEditgroupIDParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
+}
+
+/*
+func NewGetEditgroupIDHandler(db *pg.DB) operations.GetEditgroupIDHandler {
+ return &getEditgroupID{db: db}
+}
+type getCreatorID struct {
+ db *pg.DB
+}
+func (d *getCreatorID) Handle(params operations.GetEditgroupIDParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostCreatorID has not yet been implemented")
+}
+*/
+
+func NewPostEditgroupHandler(db *pg.DB) operations.PostEditgroupHandler {
+ return &postEditgroup{db: db}
+}
+type postEditgroup struct {
+ db *pg.DB
+}
+func (d *postEditgroup) Handle(params operations.PostEditgroupParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostEditgroupID has not yet been implemented")
+}
+
+func NewPostEditgroupIDAcceptHandler(db *pg.DB) operations.PostEditgroupIDAcceptHandler {
+ return &postEditgroupIDAccept{db: db}
+}
+type postEditgroupIDAccept struct {
+ db *pg.DB
+}
+func (d *postEditgroupIDAccept) Handle(params operations.PostEditgroupIDAcceptParams) middleware.Responder {
+ return middleware.NotImplemented("operation .PostEditgroupIDAcceptID has not yet been implemented")
+}
diff --git a/golang/api/handlers/entities.go b/golang/api/handlers/entities.go
index beed633a..a2fb7db8 100644
--- a/golang/api/handlers/entities.go
+++ b/golang/api/handlers/entities.go
@@ -75,6 +75,19 @@ func (d *getCreatorID) Handle(params operations.GetCreatorIDParams) middleware.R
return operations.NewGetCreatorIDOK().WithPayload(api_entity)
}
+func NewGetCreatorLookupHandler(db *pg.DB) operations.GetCreatorLookupHandler {
+ return &getCreatorLookup{db: db}
+}
+
+type getCreatorLookup struct {
+ db *pg.DB
+}
+
+func (d *getCreatorLookup) Handle(params operations.GetCreatorLookupParams) middleware.Responder {
+ // get-or-create editgroup based on current editor (session)
+ // insert new rev, ident, and edit
+ return middleware.NotImplemented("operation .GetCreatorLookup has not yet been implemented")
+}
func NewPostCreatorHandler(db *pg.DB) operations.PostCreatorHandler {
return &postCreator{db: db}