diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-10 19:57:16 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-10 19:57:16 -0700 |
commit | 63dc69bbcdbee264383b919f9a8a3b1a83358be7 (patch) | |
tree | 1b74955ed3b9938f2e7d2b690ab59c9f33c91c99 /golang/api/handlers | |
parent | 71c6b0a4418511a6c0046742512066fc27e51b21 (diff) | |
download | fatcat-63dc69bbcdbee264383b919f9a8a3b1a83358be7.tar.gz fatcat-63dc69bbcdbee264383b919f9a8a3b1a83358be7.zip |
a bunch more skeleton
Diffstat (limited to 'golang/api/handlers')
-rw-r--r-- | golang/api/handlers/editing.go | 104 | ||||
-rw-r--r-- | golang/api/handlers/entities.go | 13 |
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} |