diff options
author | r <r@freesoftwareextremist.com> | 2019-12-13 18:08:26 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2019-12-13 18:26:24 +0000 |
commit | 5e4da01c3ae3ae2e870faba9085d9d9213c01c29 (patch) | |
tree | 39d6f1e76b901549f194ddbac3c6cb82e0abd019 /model | |
download | bloat-5e4da01c3ae3ae2e870faba9085d9d9213c01c29.tar.gz bloat-5e4da01c3ae3ae2e870faba9085d9d9213c01c29.zip |
Initial commit
Diffstat (limited to 'model')
-rw-r--r-- | model/app.go | 19 | ||||
-rw-r--r-- | model/session.go | 23 |
2 files changed, 42 insertions, 0 deletions
diff --git a/model/app.go b/model/app.go new file mode 100644 index 0000000..52ebdf5 --- /dev/null +++ b/model/app.go @@ -0,0 +1,19 @@ +package model + +import "errors" + +var ( + ErrAppNotFound = errors.New("app not found") +) + +type App struct { + InstanceURL string + ClientID string + ClientSecret string +} + +type AppRepository interface { + Add(app App) (err error) + Update(instanceURL string, clientID string, clientSecret string) (err error) + Get(instanceURL string) (app App, err error) +} diff --git a/model/session.go b/model/session.go new file mode 100644 index 0000000..43628ee --- /dev/null +++ b/model/session.go @@ -0,0 +1,23 @@ +package model + +import "errors" + +var ( + ErrSessionNotFound = errors.New("session not found") +) + +type Session struct { + ID string + InstanceURL string + AccessToken string +} + +type SessionRepository interface { + Add(session Session) (err error) + Update(sessionID string, accessToken string) (err error) + Get(sessionID string) (session Session, err error) +} + +func (s Session) IsLoggedIn() bool { + return len(s.AccessToken) > 0 +} |