moved models into domain

This commit is contained in:
James Tombleson 2024-03-31 17:46:04 -07:00
parent 4981ef7f81
commit 3487feed5c
9 changed files with 56 additions and 33 deletions

4
api/domain/dto.go Normal file
View File

@ -0,0 +1,4 @@
package domain
type UserDto struct {
}

21
api/domain/entities.go Normal file
View File

@ -0,0 +1,21 @@
package domain
import "time"
type UserEntity struct {
Id int
CreatedAt time.Time
LastUpdated time.Time
Name string
Hash string
Scopes string
}
type RecipeEntity struct {
Id int32
CreatedAt time.Time
LastUpdated time.Time
Title string
Thumbnail string
Content string
}

6
api/domain/models.go Normal file
View File

@ -0,0 +1,6 @@
package domain
type EnvConfig struct {
AdminToken string
JwtSecret string
}

5
api/domain/requests.go Normal file
View File

@ -0,0 +1,5 @@
package domain
type HelloBodyRequest struct {
Name string `json:"name" validate:"required"`
}

12
api/domain/responses.go Normal file
View File

@ -0,0 +1,12 @@
package domain
type ErrorResponse struct {
HttpCode int `json:"code"`
Message string `json:"message"`
}
type HelloWhoResponse struct {
Success bool `json:"success"`
Error string `json:"error"`
Message string `json:"message"`
}

8
api/domain/scopes.go Normal file
View File

@ -0,0 +1,8 @@
package domain
const (
ScopeAll = "all"
ScopeRecipeRead = "recipe:read"
ScopeRecipeCreate = "recipe:create"
ScopeRecipeDelete = "recipe:delete"
)

View File

@ -1,12 +0,0 @@
package models
import "time"
type RecipeModel struct {
Id int32
Title string
Thumbnail string
Content string
CreatedAt time.Time
LastUpdated time.Time
}

View File

@ -1,6 +0,0 @@
package models
type ErrorResponse struct {
HttpCode int `json:"code"`
Message string `json:"message"`
}

View File

@ -1,15 +0,0 @@
package models
import "time"
type UserModel struct {
Id int
Name string
Hash string
CreatedAt time.Time
LastUpdated time.Time
}
type UserDto struct {
}