mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-01 09:34:21 +00:00
Initial commit
This commit is contained in:
commit
5e4da01c3a
43 changed files with 3429 additions and 0 deletions
19
model/app.go
Normal file
19
model/app.go
Normal file
|
@ -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)
|
||||
}
|
23
model/session.go
Normal file
23
model/session.go
Normal file
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue