Gluecode for database/handlers
This commit is contained in:
parent
ad4d439887
commit
9b67a580da
4 changed files with 55 additions and 6 deletions
21
backend/internal/types/project.go
Normal file
21
backend/internal/types/project.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Project is a struct that holds the information about a project
|
||||
type Project struct {
|
||||
ID int `json:"id" db:"id"`
|
||||
Name string `json:"name" db:"name"`
|
||||
Description string `json:"description" db:"description"`
|
||||
Owner string `json:"owner" db:"owner"`
|
||||
Created time.Time `json:"created" db:"created"`
|
||||
}
|
||||
|
||||
// As it arrives from the client
|
||||
type NewProject struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Owner string `json:"owner"`
|
||||
}
|
|
@ -16,6 +16,11 @@ func (u *User) ToPublicUser() (*PublicUser, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
type NewUser struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
// PublicUser represents a user that is safe to send over the API (no password)
|
||||
type PublicUser struct {
|
||||
UserId string `json:"userId"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue