Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
015c929b
Commit
015c929b
authored
Sep 20, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more account stuff
parent
992efda7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
4 deletions
+39
-4
pkg/api/api_account.go
+18
-2
pkg/api/api_dtos.go
+18
-0
pkg/api/api_register.go
+0
-1
pkg/models/account.go
+3
-1
No files found.
pkg/api/api_account.go
View file @
015c929b
...
@@ -5,11 +5,27 @@ import "github.com/gin-gonic/gin"
...
@@ -5,11 +5,27 @@ import "github.com/gin-gonic/gin"
func
init
()
{
func
init
()
{
addRoutes
(
func
(
self
*
HttpServer
)
{
addRoutes
(
func
(
self
*
HttpServer
)
{
self
.
addRoute
(
"POST"
,
"/api/account/collaborators/add"
,
self
.
addCollaborator
)
self
.
addRoute
(
"POST"
,
"/api/account/collaborators/add"
,
self
.
addCollaborator
)
self
.
addRoute
(
"GET"
,
"/api/account/"
,
self
.
getAccount
)
})
})
}
}
type
addCollaboratorDto
struct
{
func
(
self
*
HttpServer
)
getAccount
(
c
*
gin
.
Context
,
auth
*
authContext
)
{
Email
string
`json:"email" binding:"required"`
var
account
=
auth
.
userAccount
model
:=
accountInfoDto
{
Login
:
account
.
Login
,
Email
:
account
.
Email
,
AccountName
:
account
.
AccountName
,
}
for
_
,
collaborator
:=
range
account
.
Collaborators
{
model
.
Collaborators
=
append
(
model
.
Collaborators
,
&
collaboratorInfoDto
{
AccountId
:
collaborator
.
AccountId
,
Role
:
collaborator
.
Role
,
})
}
c
.
JSON
(
200
,
model
)
}
}
func
(
self
*
HttpServer
)
addCollaborator
(
c
*
gin
.
Context
,
auth
*
authContext
)
{
func
(
self
*
HttpServer
)
addCollaborator
(
c
*
gin
.
Context
,
auth
*
authContext
)
{
...
...
pkg/api/api_dtos.go
0 → 100644
View file @
015c929b
package
api
type
accountInfoDto
struct
{
Login
string
`json:"login"`
Email
string
`json:"email"`
AccountName
string
`json:"accountName"`
Collaborators
[]
*
collaboratorInfoDto
`json:"collaborators"`
}
type
collaboratorInfoDto
struct
{
AccountId
int
`json:"accountId"`
Email
string
`json:"email"`
Role
string
`json:"role"`
}
type
addCollaboratorDto
struct
{
Email
string
`json:"email" binding:"required"`
}
pkg/api/api_register.go
View file @
015c929b
...
@@ -28,7 +28,6 @@ func (self *HttpServer) registerUserPost(c *gin.Context) {
...
@@ -28,7 +28,6 @@ func (self *HttpServer) registerUserPost(c *gin.Context) {
}
}
account
:=
models
.
Account
{
account
:=
models
.
Account
{
UserName
:
registerModel
.
Email
,
Login
:
registerModel
.
Email
,
Login
:
registerModel
.
Email
,
Email
:
registerModel
.
Email
,
Email
:
registerModel
.
Email
,
Password
:
registerModel
.
Password
,
Password
:
registerModel
.
Password
,
...
...
pkg/models/account.go
View file @
015c929b
...
@@ -14,15 +14,17 @@ type CollaboratorLink struct {
...
@@ -14,15 +14,17 @@ type CollaboratorLink struct {
type
Account
struct
{
type
Account
struct
{
Id
int
`gorethink:"id"`
Id
int
`gorethink:"id"`
UserName
string
Version
int
Login
string
Login
string
Email
string
Email
string
AccountName
string
Password
string
Password
string
NextDashboardId
int
NextDashboardId
int
UsingAccountId
int
UsingAccountId
int
Collaborators
[]
CollaboratorLink
Collaborators
[]
CollaboratorLink
CreatedOn
time
.
Time
CreatedOn
time
.
Time
ModifiedOn
time
.
Time
ModifiedOn
time
.
Time
LastLoginOn
time
.
Time
}
}
func
(
account
*
Account
)
AddCollaborator
(
accountId
int
)
error
{
func
(
account
*
Account
)
AddCollaborator
(
accountId
int
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment