-
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.
- Loading branch information
1 parent
a0934a9
commit 5a269cc
Showing
13 changed files
with
66 additions
and
47 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
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
package domain | ||
|
||
import ( | ||
"github.com/google/uuid" | ||
"github.com/uptrace/bun" | ||
"time" | ||
) | ||
|
||
type Profile struct { | ||
bun.BaseModel `bun:"table:profiles"` | ||
|
||
ID uuid.UUID `bun:",pk,type:uuid,default:uuid_generate_v4()" json:"ProfileID"` | ||
ID int `bun:",pk"` | ||
FirstName string `json:"FirstName"` | ||
LastName string `json:"LastName"` | ||
UserID uuid.UUID `bun:"type:uuid" json:"-"` | ||
UserID int | ||
User *User `bun:"rel:belongs-to,join:user_id=id"` | ||
Addresses []Address `json:"-"` | ||
CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` | ||
UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"` | ||
} | ||
|
||
type ProfileDto struct { | ||
type ProfileDTO struct { | ||
FirstName string `json:"FirstName" binding:"required"` | ||
LastName string `json:"LastName" binding:"required"` | ||
UserID uuid.UUID `json:"UserID"` | ||
UserID int `json:"UserID"` | ||
} |
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,16 @@ | ||
package errorcode | ||
|
||
type ErrorCode string | ||
|
||
const ( | ||
Success ErrorCode = "SUCCESS" | ||
InvalidRequest ErrorCode = "INVALID_REQUEST" | ||
DuplicateUser ErrorCode = "DUPLICATE_USER" | ||
InternalError ErrorCode = "INTERNAL_ERROR" | ||
) | ||
|
||
const ( | ||
SuccessErrorMessage = "success" | ||
InternalErrorMessage = "internal error" | ||
InvalidRequestErrorMessage = "invalid request" | ||
) |
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 response | ||
|
||
import "server/internal/core/entity/errorcode" | ||
|
||
type Response struct { | ||
Data interface{} `json:"data"` | ||
Status bool `json:"status"` | ||
ErrorCode errorcode.ErrorCode `json:"errorCode"` | ||
ErrorMessage string `json:"errorMessage"` | ||
} |
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