generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ismael Ibuan <[email protected]>
- Loading branch information
Showing
23 changed files
with
236 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package model | ||
|
||
type User struct { | ||
UserPrincipalName string `json:"userPrincipalName"` | ||
Name string `json:"name"` | ||
GivenName string `json:"givenName"` | ||
Surname string `json:"surname"` | ||
JobTitle string `json:"jobTitle"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
src/goapp/repository/approver/approver-repository-interface.go
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/goapp/repository/repository-approver/repository-approver-repository-interface.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package repositoryApprover | ||
|
||
import ( | ||
"main/model" | ||
) | ||
|
||
type RepositoryApproverRepository interface { | ||
Insert(approver *model.RepositoryApprover) error | ||
SelectByApprovalTypeId(approvalTypeId int) ([]model.RepositoryApprover, error) | ||
} |
17 changes: 12 additions & 5 deletions
17
...epository/approver/approver-repository.go → ...pprover/repository-approver-repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package user | ||
|
||
import ( | ||
"main/model" | ||
) | ||
|
||
type UserRepository interface { | ||
Insert(*model.User) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package user | ||
|
||
import ( | ||
"database/sql" | ||
db "main/infrastructure/database" | ||
"main/model" | ||
) | ||
|
||
type userRepository struct { | ||
*db.Database | ||
} | ||
|
||
func NewUserRepository(db *db.Database) UserRepository { | ||
return &userRepository{db} | ||
} | ||
|
||
func (r *userRepository) Insert(user *model.User) error { | ||
err := r.Execute("usp_User_Insert", | ||
sql.Named("UserPrincipalName", user.UserPrincipalName), | ||
sql.Named("Name", user.Name), | ||
sql.Named("GivenName", user.GivenName), | ||
sql.Named("Surname", user.Surname), | ||
sql.Named("JobTitle", user.JobTitle), | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/goapp/service/repository-approver/repository-approver-service-interface.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package repositoryApprover | ||
|
||
import ( | ||
"main/model" | ||
) | ||
|
||
type RepositoryApproverService interface { | ||
Create(approver *model.RepositoryApprover) error | ||
Get(approvalTypeId int) ([]model.RepositoryApprover, error) | ||
} |
22 changes: 22 additions & 0 deletions
22
src/goapp/service/repository-approver/repository-approver-service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package repositoryApprover | ||
|
||
import ( | ||
"main/model" | ||
"main/repository" | ||
) | ||
|
||
type repositoryApproverService struct { | ||
Repository *repository.Repository | ||
} | ||
|
||
func NewRepositoryApproverService(repository *repository.Repository) RepositoryApproverService { | ||
return &repositoryApproverService{repository} | ||
} | ||
|
||
func (s *repositoryApproverService) Create(approver *model.RepositoryApprover) error { | ||
return s.Repository.RepositoryApprover.Insert(approver) | ||
} | ||
|
||
func (s *repositoryApproverService) Get(approvalTypeId int) ([]model.RepositoryApprover, error) { | ||
return s.Repository.RepositoryApprover.SelectByApprovalTypeId(approvalTypeId) | ||
} |
Oops, something went wrong.