Spaces:
Configuration error
Configuration error
Commit ·
7e1ff30
1
Parent(s): f04ece2
Deploy files from GitHub repository
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- LICENSEAdded+201
- README.md+71-8
- space/.github/workflows/main.yml+1-1
- space/space/.github/workflows/main.yml+1-1
- space/space/space/.gitignore+2-1
- space/space/space/config/config.goAdded+21
- space/space/space/config/database_connection_config.goAdded+60
- space/space/space/controller/home_controller.goAdded+9
- space/space/space/controller/login_controller.goAdded+19
- space/space/space/controller/register_controller.goAdded+19
- space/space/space/middleware/authentication_middleware.goAdded+104
- space/space/space/middleware/response_middleware.goAdded+39
- space/space/space/models/authentication_payload_model.goAdded+7
- space/space/space/models/database_orm_model.goAdded+31
- space/space/space/models/exception_model.goAdded+12
- space/space/space/models/model.goAdded+1
- space/space/space/models/request_model.goAdded+13
- space/space/space/models/response_model.goAdded+19
- space/space/space/repositories/account_repository.goAdded+24
- space/space/space/repositories/repository.goAdded+113
- space/space/space/services/login_service.goAdded+47
- space/space/space/services/register_service.goAdded+40
- space/space/space/services/service.goAdded+31
- space/space/space/space/README.md+71-8
- space/space/space/space/config/DatabaseConfig.go+17-17
- space/space/space/space/controller/LoginController.go+2-2
- space/space/space/space/controller/RegisterController.go+2-2
- space/space/space/space/controller/controller.go+3-3
- space/space/space/space/go.mod+26-26
- space/space/space/space/go.sum+50-72
- space/space/space/space/main.go+2-2
- space/space/space/space/middleware/AuthMiddleware.go+13-12
- space/space/space/space/repositories/AccountRepository.go+1-1
- space/space/space/space/repositories/DatabaseScoope.go+1-1
- space/space/space/space/repositories/repositories.go+1-1
- space/space/space/space/router/router.go+2-2
- space/space/space/space/services/LoginService.go+3-3
- space/space/space/space/services/RegisterService.go+3-3
- space/space/space/space/services/services.go+2-2
- space/space/space/space/space/models/ExceptionModel.go+8-7
- space/space/space/space/space/services/RegisterService.go+5
- space/space/space/space/space/space/repositories/AccountRepository.go+2-2
- space/space/space/space/space/space/repositories/repositories.go-7
- space/space/space/space/space/space/services/LoginService.go+1-1
- space/space/space/space/space/space/services/RegisterService.go+2
- space/space/space/space/space/space/space/go.mod+1
- space/space/space/space/space/space/space/go.sum+2
- space/space/space/space/space/space/space/models/DatabaseModel.go+17-5
- space/space/space/space/space/space/space/repositories/AccountRepository.go-3
- space/space/space/space/space/space/space/services/RegisterService.go+3-2
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright 2025 Abdan Hafidz
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.12345678---title: Quzuu Api Devemoji: 🐠colorFrom: indigocolorTo: graysdk: dockerpinned: false---1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071# Golang API BoilerplateThis is a boilerplate for a RESTful API written in Golang.## Features- [x] JWT Authentication- [x] PostgreSQL Database- [x] GORM ORM- [x] Gin Framework- [x] Docker Support- [x] Environment Variables- [x] Logging- [x] Error Handling## Getting Started1. Clone the repository2. Run `go get` to download the dependencies3. Create a file named `.env` and add the following variables:* `DB_HOST`* `DB_USER`* `DB_PASSWORD`* `DB_NAME`* `DB_PORT`* `SALT`* `HOST_ADDRESS`* `HOST_PORT`* `LOG_PATH`4. Run `go run main.go` to start the server5. Open your browser and navigate to `http://localhost:HOST_PORT`## API Endpoints### Authentication- `POST /login`: Login with email and password- `POST /register`: Register a new user- `GET /logout`: Logout### Users- `GET /users`: Get all users- `GET /users/:id`: Get a user by ID- `PUT /users/:id`: Update a user- `DELETE /users/:id`: Delete a user## Docker SupportYou can build a Docker image by running `docker build -t my-api .` and then run it with `docker run -p 8080:8080 my-api`.## Environment VariablesYou can set the following environment variables:- `DB_HOST`- `DB_USER`- `DB_PASSWORD`- `DB_NAME`- `DB_PORT`- `SALT`- `HOST_ADDRESS`- `HOST_PORT`- `LOG_PATH`## LoggingThe API uses the `log` package to log errors. You can set the `LOG_PATH` environment variable to specify the log file path.## Error HandlingThe API uses the `errors` package to handle errors. You can set the `ERROR_PATH` environment variable to specify the error file path.# Command Documentation## Update Golang Project version> go mod edit -go 1.24> go mod tidy## Update all package> go get -u ./...> go mod tidy
48 unmodified lines4950515248 unmodified linescd spacegit add .git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"git push --force origin main || echo "No changes to push"48 unmodified lines4950515248 unmodified linescd spacegit add .git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"git push origin main || echo "No changes to push"
48 unmodified lines4950515248 unmodified linescd spacegit add .git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"git push origin main || echo "No changes to push"48 unmodified lines4950515248 unmodified linescd spacegit add .git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"git push --force origin main || echo "No changes to push"
123.envvendor/quzuu-be.exe1234.envvendor/quzuu-be.exeREADME.md
123456789101112131415161718192021package config
import (
"os"
"github.com/joho/godotenv"
)
var TCP_ADDRESS string
var LOG_PATH string
var HOST_ADDRESS string
var HOST_PORT string
func init() {
godotenv.Load()
HOST_ADDRESS = os.Getenv("HOST_ADDRESS")
HOST_PORT = os.Getenv("HOST_PORT")
TCP_ADDRESS = HOST_ADDRESS + ":" + HOST_PORT
LOG_PATH = os.Getenv("LOG_PATH")
// Menampilkan nilai variabel lingkungan
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960package config
import (
"fmt"
"log"
"os"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"api.qobiltu.id/models"
"github.com/joho/godotenv"
)
var DB *gorm.DB
var err error
var Salt string
func init() {
godotenv.Load()
if err != nil {
fmt.Println("Gagal membaca file .env")
return
}
os.Setenv("TZ", "Asia/Jakarta")
dbHost := os.Getenv("DB_HOST")
dbPort := os.Getenv("DB_PORT")
dbUser := os.Getenv("DB_USER")
dbPassword := os.Getenv("DB_PASSWORD")
dbName := os.Getenv("DB_NAME")
Salt := os.Getenv("SALT")
dsn := "host=" + dbHost + " user=" + dbUser + " password=" + dbPassword + " dbname=" + dbName + " port=" + dbPort + " sslmode=disable TimeZone=Asia/Jakarta"
DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{TranslateError: true})
if err != nil {
panic(err)
}
if Salt == "" {
Salt = "D3f4u|t"
}
// Call AutoMigrateAll to perform auto-migration
AutoMigrateAll(DB)
}
func AutoMigrateAll(db *gorm.DB) {
// Enable logger to see SQL logs
db.Logger.LogMode(logger.Info)
// Auto-migrate all models
err := db.AutoMigrate(
&models.Account{},
&models.AccountDetails{},
)
if err != nil {
log.Fatal(err)
}
fmt.Println("Migration completed successfully.")
}123456789package controller
import "github.com/gin-gonic/gin"
func HomeController(c *gin.Context) {
c.JSON(200, gin.H{
"message": "Api Qobiltu 2025!",
})
}12345678910111213141516171819package controller
import (
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func LoginController(c *gin.Context) {
authentication := services.AuthenticationService{}
loginController := Controller[models.LoginRequest, services.LoginConstructor, models.AuthenticatedUser]{
Service: &authentication.Service,
}
loginController.RequestJSON(c, func() {
loginController.Service.Constructor.Email = loginController.Request.Email
loginController.Service.Constructor.Password = loginController.Request.Password
authentication.Authenticate()
})
}12345678910111213141516171819package controller
import (
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func RegisterController(c *gin.Context) {
register := services.RegisterService{}
registerController := Controller[models.RegisterRequest, models.Account, models.Account]{
Service: ®ister.Service,
}
registerController.RequestJSON(c, func() {
registerController.Service.Constructor.Password = registerController.Request.Password
registerController.Service.Constructor.Email = registerController.Request.Email
register.Create()
})
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104// auth/auth.go
package middleware
import (
"errors"
"time"
"api.qobiltu.id/config"
"api.qobiltu.id/models"
"github.com/gin-gonic/gin"
"github.com/golang-jwt/jwt/v5"
"golang.org/x/crypto/bcrypt"
)
// Define a secret key for signing the JWT token
var salt = config.Salt
var secretKey = []byte(salt)
// GenerateToken generates a JWT token for the given user
func GenerateToken(user *models.Account) (string, error) {
// Create a new token
token := jwt.New(jwt.SigningMethodHS256)
// Set claims
claims := token.Claims.(jwt.MapClaims)
claims["id"] = user.Id
claims["exp"] = time.Now().Add(time.Hour * 24).Unix() // Token expires in 24 hours
// Sign the token with the secret key
tokenString, err := token.SignedString(secretKey)
if err != nil {
return "", err
}
return tokenString, nil
}
// VerifyPassword verifies if the provided password matches the hashed password
func VerifyPassword(hashedPassword, password string) error {
err := bcrypt.CompareHashAndPassword([]byte(hashedPassword), []byte(password))
if err != nil {
return errors.New("invalid password")
}
return nil
}
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14)
return string(bytes), err
}
type CustomClaims struct {
jwt.RegisteredClaims
UserID int `json:"id"`
}
func VerifyToken(bearer_token string) (int, string, error) {
// fmt.Println(bearer_token)
token, err := jwt.ParseWithClaims(bearer_token, &CustomClaims{}, func(token *jwt.Token) (interface{}, error) {
return secretKey, nil
})
if err != nil {
return 0, "invalid-token", err
}
// Extract the claims
claims, ok := token.Claims.(*CustomClaims)
if !ok || !token.Valid {
return 0, "invalid-token", err
}
if claims.ExpiresAt != nil && claims.ExpiresAt.Time.Before(time.Now()) {
return 0, "expired", err
}
return claims.UserID, "valid", err
}
func AuthUser(c *gin.Context) {
var currAccData models.AccountData
if c.Request.Header["Auth-Bearer-Token"] != nil {
token := c.Request.Header["Auth-Bearer-Token"]
currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = VerifyToken(token[0])
// fmt.Println("Verify Status :", currAccData.verifyStatus)
if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {
currAccData.UserID = 0
message := "Your session is expired, Please re-Login!"
SendJSON401(c, &currAccData.VerifyStatus, &message)
c.Abort()
return
}
} else {
currAccData.UserID = 0
currAccData.VerifyStatus = "no-token"
currAccData.ErrVerif = nil
message := "You have to Login First!"
SendJSON401(c, &currAccData.VerifyStatus, &message)
c.Abort()
return
}
c.Set("accountData", currAccData)
c.Next()
}123456789101112131415161718192021222324252627282930313233343536373839package middleware
import (
"net/http"
"github.com/gin-gonic/gin"
)
// SendJSON200 sends a JSON response with HTTP status code 200
func SendJSON200(c *gin.Context, data interface{}) {
c.JSON(http.StatusOK, gin.H{"status": "success", "data": data})
}
// SendJSON400 sends a JSON response with HTTP status code 400
func SendJSON400(c *gin.Context, error_status *string, message *string) {
c.JSON(http.StatusBadRequest, gin.H{"status": "error", "error-status": error_status, "message": message})
}
// SendJSON401 sends a JSON response with HTTP status code 401
func SendJSON401(c *gin.Context, error_status *string, message *string) {
c.JSON(http.StatusUnauthorized, gin.H{"status": "error", "error-status": error_status, "message": message})
}
// SendJSON403 sends a JSON response with HTTP status code 403
func SendJSON403(c *gin.Context, message *string) {
c.JSON(http.StatusForbidden, gin.H{"status": "error", "message": message})
}
// SendJSON404 sends a JSON response with HTTP status code 404
func SendJSON404(c *gin.Context, message *string) {
c.JSON(http.StatusNotFound, gin.H{"status": "error", "message": message})
}
// SendJSON500 sends a JSON response with HTTP status code 500
func SendJSON500(c *gin.Context, error_status *string, message *string) {
c.JSON(http.StatusInternalServerError, gin.H{"status": "error", "error-status": error_status, "message": message})
}
// JSONResponseMiddleware is a middleware that provides functions for sending JSON responses1234567package models
type AccountData struct {
UserID int
VerifyStatus string
ErrVerif error
}12345678910111213141516171819202122232425262728293031package models
import (
"time"
uuid "github.com/satori/go.uuid"
)
type Account struct {
Id uint `gorm:"primaryKey" json:"id"`
UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `
Email string `gorm:"uniqueIndex" json:"email"`
Password string `json:"password"`
IsEmailVerified bool `json:"is_email_verified"`
CreatedAt time.Time `json:"created_at"`
DeletedAt time.Time `json:"deleted_at"`
}
type AccountDetails struct {
IDDetail uint `gorm:"primaryKey" json:"id_detail"`
Account_id uint `json:"id_account"`
Province string `json:"province"`
City string `json:"city"`
Institution string `json:"institution"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
}
// Gorm table name settings
func (Account) TableName() string { return "account" }
func (AccountDetails) TableName() string { return "account_details" }123456789101112package models
type Exception struct {
Unauthorized bool `json:"unauthorized,omitempty"`
BadRequest bool `json:"bad_request,omitempty"`
DataNotFound bool `json:"data_not_found,omitempty"`
InternalServerError bool `json:"internal_server_error,omitempty"`
DataDuplicate bool `json:"data_duplicate,omitempty"`
QueryError bool `json:"query_error,omitempty"`
InvalidPasswordLength bool `json:"invalid_password_length,omitempty"`
Message string `json:"message,omitempty"`
}1package models12345678910111213package models
type LoginRequest struct {
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
}
type RegisterRequest struct {
Name string `json:"name"`
Email string `json:"email" binding:"required,email"`
Phone int `json:"phone"`
Password string `json:"password" binding:"required"`
}12345678910111213141516171819package models
type SuccessResponse struct {
Status string `json:"status"`
Message string `json:"message"`
Data any `json:"data"`
MetaData any `json:"meta_data"`
}
type ErrorResponse struct {
Status string `json:"status"`
Message string `json:"message"`
Errors Exception `json:"errors"`
MetaData any `json:"meta_data"`
}
type AuthenticatedUser struct {
Account Account `json:"account"`
Token string `json:"token"`
}123456789101112131415161718192021222324package repositories
import (
"api.qobiltu.id/models"
)
func GetAccountbyEmail(email string) Repository[models.Account, models.Account] {
repo := Construct[models.Account, models.Account](
models.Account{Email: email},
)
repo.Transactions(
WhereGivenConstructor[models.Account, models.Account],
Find[models.Account, models.Account],
)
return *repo
}
func CreateAccount(account models.Account) Repository[models.Account, models.Account] {
repo := Construct[models.Account, models.Account](
account,
)
Create(repo)
return *repo
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113package repositories
import (
"api.qobiltu.id/config"
"gorm.io/gorm"
)
type Repositories interface {
FindAllPaginate()
Where()
Find()
Create()
Update()
CustomQuery()
Delete()
}
type PaginationConstructor struct {
Limit int
Offset int
Filter string
}
type CustomQueryConstructor struct {
SQL string
Values interface{}
}
type Repository[TConstructor any, TResult any] struct {
Constructor TConstructor
Pagination PaginationConstructor
CustomQuery CustomQueryConstructor
Result TResult
Transaction *gorm.DB
RowsCount int
NoRecord bool
RowsError error
}
func Construct[TConstructor any, TResult any](constructor ...TConstructor) *Repository[TConstructor, TResult] {
if len(constructor) == 1 {
return &Repository[TConstructor, TResult]{
Constructor: constructor[0],
Transaction: config.DB,
}
}
return &Repository[TConstructor, TResult]{
Constructor: constructor[0],
Transaction: config.DB.Begin(),
}
}
func (repo *Repository[T1, T2]) Transactions(transactions ...func(*Repository[T1, T2]) *gorm.DB) {
for _, tx := range transactions {
repo.Transaction = tx(repo)
if repo.RowsError != nil {
return
}
}
}
func WhereGivenConstructor[T1 any, T2 any](repo *Repository[T1, T2]) *gorm.DB {
tx := repo.Transaction.Where(&repo.Constructor)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}
func Find[T1 any, T2 any](repo *Repository[T1, T2]) *gorm.DB {
tx := repo.Transaction.Find(&repo.Result)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}
func FinddAllPaginate[T1 any, T2 any](repo *Repository[T1, T2]) *gorm.DB {
tx := repo.Transaction.Limit(repo.Pagination.Limit).Offset(repo.Pagination.Offset).Find(&repo.Result)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}
func Create[T1 any](repo *Repository[T1, T1]) *gorm.DB {
tx := repo.Transaction.Create(&repo.Constructor)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
repo.Result = repo.Constructor
return tx
}
func Update[T1 any](repo *Repository[T1, T1]) *gorm.DB {
tx := repo.Transaction.Save(&repo.Constructor)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}
func Delete[T1 any](repo *Repository[T1, T1]) *gorm.DB {
tx := repo.Transaction.Delete(&repo.Constructor)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}
func CustomQuery[T1 any, T2 any](repo *Repository[T1, T2]) *gorm.DB {
tx := repo.Transaction.Raw(repo.CustomQuery.SQL, repo.CustomQuery.Values).Scan(&repo.Result)
repo.RowsCount = int(tx.RowsAffected)
repo.NoRecord = repo.RowsCount == 0
repo.RowsError = tx.Error
return tx
}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647package services
import (
"errors"
"api.qobiltu.id/middleware"
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
)
type LoginConstructor struct {
Email string
Password string
}
type AuthenticationService struct {
Service[LoginConstructor, models.AuthenticatedUser]
}
func (s *AuthenticationService) Authenticate() {
accountData := repositories.GetAccountbyEmail(s.Constructor.Email)
if accountData.NoRecord {
s.Exception.DataNotFound = true
s.Exception.Message = "there is no account with given credentials!"
return
}
if middleware.VerifyPassword(accountData.Result.Password, s.Constructor.Password) != nil {
s.Exception.Unauthorized = true
s.Exception.Message = "incorrect password!"
return
}
token, err_tok := middleware.GenerateToken(&accountData.Result)
if err_tok != nil {
s.Error = errors.Join(s.Error, err_tok)
}
accountData.Result.Password = "SECRET"
s.Result = models.AuthenticatedUser{
Account: accountData.Result,
Token: token,
}
s.Error = accountData.RowsError
}
// LoginHandler handles user login12345678910111213141516171819202122232425262728293031323334353637383940package services
import (
"errors"
"api.qobiltu.id/middleware"
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
)
type RegisterService struct {
Service[models.Account, models.Account]
}
func (s *RegisterService) Create() {
if len(s.Constructor.Password) < 8 {
s.Exception.InvalidPasswordLength = true
s.Exception.Message = "Password must have at least 8 characters!"
return
}
hashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)
s.Error = err_hash
s.Constructor.Password = hashed_password
s.Constructor.UUID = uuid.NewV4()
accountCreated := repositories.CreateAccount(s.Constructor)
if errors.Is(accountCreated.RowsError, gorm.ErrDuplicatedKey) {
s.Exception.DataDuplicate = true
s.Exception.Message = "Account with email " + s.Constructor.Email + " already exists!"
return
} else if errors.Is(accountCreated.RowsError, gorm.ErrModelAccessibleFieldsRequired) || errors.Is(accountCreated.RowsError, gorm.ErrInvalidData) || errors.Is(accountCreated.RowsError, gorm.ErrInvalidValue) || errors.Is(accountCreated.RowsError, gorm.ErrInvalidField) {
s.Exception.BadRequest = true
s.Exception.Message = "Bad request!"
return
}
s.Error = accountCreated.RowsError
s.Result = accountCreated.Result
s.Result.Password = "SECRET"
}12345678910111213141516171819202122232425262728293031package services
import "api.qobiltu.id/models"
type (
Services interface {
Retrieve()
Update()
Create()
Delete()
Validate()
Authenticate()
Authorize()
}
Service[TConstructor any, TResult any] struct {
Constructor TConstructor
Result TResult
Exception models.Exception
Error error
}
)
func Construct[TConstructor any, TResult any](constructor ...TConstructor) *Service[TConstructor, TResult] {
if len(constructor) == 1 {
return &Service[TConstructor, TResult]{}
}
return &Service[TConstructor, TResult]{
Constructor: constructor[0],
}
}12345678---title: Quzuu Api Devemoji: 🐠colorFrom: indigocolorTo: graysdk: dockerpinned: false---1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071# Golang API BoilerplateThis is a boilerplate for a RESTful API written in Golang.## Features- [x] JWT Authentication- [x] PostgreSQL Database- [x] GORM ORM- [x] Gin Framework- [x] Docker Support- [x] Environment Variables- [x] Logging- [x] Error Handling## Getting Started1. Clone the repository2. Run `go get` to download the dependencies3. Create a file named `.env` and add the following variables:* `DB_HOST`* `DB_USER`* `DB_PASSWORD`* `DB_NAME`* `DB_PORT`* `SALT`* `HOST_ADDRESS`* `HOST_PORT`* `LOG_PATH`4. Run `go run main.go` to start the server5. Open your browser and navigate to `http://localhost:HOST_PORT`## API Endpoints### Authentication- `POST /login`: Login with email and password- `POST /register`: Register a new user- `GET /logout`: Logout### Users- `GET /users`: Get all users- `GET /users/:id`: Get a user by ID- `PUT /users/:id`: Update a user- `DELETE /users/:id`: Delete a user## Docker SupportYou can build a Docker image by running `docker build -t my-api .` and then run it with `docker run -p 8080:8080 my-api`.## Environment VariablesYou can set the following environment variables:- `DB_HOST`- `DB_USER`- `DB_PASSWORD`- `DB_NAME`- `DB_PORT`- `SALT`- `HOST_ADDRESS`- `HOST_PORT`- `LOG_PATH`## LoggingThe API uses the `log` package to log errors. You can set the `LOG_PATH` environment variable to specify the log file path.## Error HandlingThe API uses the `errors` package to handle errors. You can set the `ERROR_PATH` environment variable to specify the error file path.# Command Documentation## Update Golang Project version> go mod edit -go 1.24> go mod tidy## Update all package> go get -u ./...> go mod tidy
8 unmodified lines91011121314151617181920212223242526272829303132333423 unmodified lines5859608 unmodified lines"gorm.io/gorm""gorm.io/gorm/logger""github.com/joho/godotenv""go-dp.abdanhafidz.com/models")func AutoMigrateAll(db *gorm.DB) {// Enable logger to see SQL logsdb.Logger.LogMode(logger.Info)// Auto-migrate all modelserr := db.AutoMigrate(&models.Account{},&models.AccountDetails{},)if err != nil {log.Fatal(err)}fmt.Println("Migration completed successfully.")}var DB *gorm.DBvar err errorvar Salt string23 unmodified lines// Call AutoMigrateAll to perform auto-migrationAutoMigrateAll(DB)}8 unmodified lines910111213141516171823 unmodified lines424344454647484950515253545556575859608 unmodified lines"gorm.io/gorm""gorm.io/gorm/logger""api.qobiltu.id/models""github.com/joho/godotenv")var DB *gorm.DBvar err errorvar Salt string23 unmodified lines// Call AutoMigrateAll to perform auto-migrationAutoMigrateAll(DB)}func AutoMigrateAll(db *gorm.DB) {// Enable logger to see SQL logsdb.Logger.LogMode(logger.Info)// Auto-migrate all modelserr := db.AutoMigrate(&models.Account{},&models.AccountDetails{},)if err != nil {log.Fatal(err)}fmt.Println("Migration completed successfully.")}
123456789package controllerimport ("github.com/gin-gonic/gin""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/services")func LoginController(c *gin.Context) {123456789package controllerimport ("api.qobiltu.id/models""api.qobiltu.id/services""github.com/gin-gonic/gin")func LoginController(c *gin.Context) {
123456789package controllerimport ("github.com/gin-gonic/gin""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/services")func RegisterController(c *gin.Context) {123456789package controllerimport ("api.qobiltu.id/models""api.qobiltu.id/services""github.com/gin-gonic/gin")func RegisterController(c *gin.Context) {
12345678910package controllerimport ("github.com/gin-gonic/gin""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/services""go-dp.abdanhafidz.com/utils")type (12345678910package controllerimport ("api.qobiltu.id/models""api.qobiltu.id/services""api.qobiltu.id/utils""github.com/gin-gonic/gin")type (
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849module go-dp.abdanhafidz.comgo 1.21.0require (github.com/dgrijalva/jwt-go v3.2.0+incompatiblegithub.com/gin-gonic/gin v1.9.1github.com/joho/godotenv v1.5.1golang.org/x/crypto v0.32.0gorm.io/driver/postgres v1.5.4gorm.io/gorm v1.25.5)require (github.com/bytedance/sonic v1.10.2 // indirectgithub.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirectgithub.com/chenzhuoyu/iasm v0.9.0 // indirectgithub.com/gabriel-vasile/mimetype v1.4.8 // indirectgithub.com/gin-contrib/sse v0.1.0 // indirectgithub.com/go-playground/locales v0.14.1 // indirectgithub.com/go-playground/universal-translator v0.18.1 // indirectgithub.com/go-playground/validator/v10 v10.25.0 // indirectgithub.com/goccy/go-json v0.10.2 // indirectgithub.com/jackc/pgpassfile v1.0.0 // indirectgithub.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirectgithub.com/jackc/pgx/v5 v5.5.0 // indirectgithub.com/jackc/puddle/v2 v2.2.1 // indirectgithub.com/jinzhu/inflection v1.0.0 // indirectgithub.com/jinzhu/now v1.1.5 // indirectgithub.com/json-iterator/go v1.1.12 // indirectgithub.com/klauspost/cpuid/v2 v2.2.6 // indirectgithub.com/kr/text v0.2.0 // indirectgithub.com/leodido/go-urn v1.4.0 // indirectgithub.com/mattn/go-isatty v0.0.20 // indirectgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirectgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.1.0 // indirectgithub.com/rogpeppe/go-internal v1.11.0 // indirectgithub.com/satori/go.uuid v1.2.0 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.11 // indirectgolang.org/x/arch v0.6.0 // indirectgolang.org/x/net v0.34.0 // indirectgolang.org/x/sync v0.10.0 // indirectgolang.org/x/sys v0.29.0 // indirectgolang.org/x/text v0.21.0 // indirectgoogle.golang.org/protobuf v1.31.0 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect)12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849module api.qobiltu.idgo 1.24.0require (github.com/gin-gonic/gin v1.10.0github.com/golang-jwt/jwt/v5 v5.2.1github.com/joho/godotenv v1.5.1github.com/satori/go.uuid v1.2.0golang.org/x/crypto v0.36.0gorm.io/driver/postgres v1.5.11gorm.io/gorm v1.25.12)require (github.com/bytedance/sonic v1.13.1 // indirectgithub.com/bytedance/sonic/loader v0.2.4 // indirectgithub.com/cloudwego/base64x v0.1.5 // indirectgithub.com/gabriel-vasile/mimetype v1.4.8 // indirectgithub.com/gin-contrib/sse v1.0.0 // indirectgithub.com/go-playground/locales v0.14.1 // indirectgithub.com/go-playground/universal-translator v0.18.1 // indirectgithub.com/go-playground/validator/v10 v10.25.0 // indirectgithub.com/goccy/go-json v0.10.5 // indirectgithub.com/jackc/pgpassfile v1.0.0 // indirectgithub.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirectgithub.com/jackc/pgx/v5 v5.7.2 // indirectgithub.com/jackc/puddle/v2 v2.2.2 // indirectgithub.com/jinzhu/inflection v1.0.0 // indirectgithub.com/jinzhu/now v1.1.5 // indirectgithub.com/json-iterator/go v1.1.12 // indirectgithub.com/klauspost/cpuid/v2 v2.2.10 // indirectgithub.com/kr/text v0.2.0 // indirectgithub.com/leodido/go-urn v1.4.0 // indirectgithub.com/mattn/go-isatty v0.0.20 // indirectgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirectgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.2.3 // indirectgithub.com/rogpeppe/go-internal v1.11.0 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.12 // indirectgolang.org/x/arch v0.15.0 // indirectgolang.org/x/net v0.37.0 // indirectgolang.org/x/sync v0.12.0 // indirectgolang.org/x/sys v0.31.0 // indirectgolang.org/x/text v0.23.0 // indirectgoogle.golang.org/protobuf v1.36.5 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950513 unmodified lines5556575859606162636465666768693 unmodified lines73747576777879803 unmodified lines84858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo=github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=github.com/jackc/pgx/v5 v5.5.0 h1:NxstgwndsTRy7eq9/kqYc/BZh5w2hHJV86wjvO+1xPw=github.com/jackc/pgx/v5 v5.5.0/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA=github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=3 unmodified linesgithub.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=3 unmodified linesgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=3 unmodified linesgithub.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo=gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0=gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls=gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=12345678910111213141516171819202122232425262728293031323334353637383940414243443 unmodified lines484950515253545556575859603 unmodified lines64656667686970713 unmodified lines75767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=github.com/jackc/pgx/v5 v5.7.2 h1:mLoDLV6sonKlvjIEsV56SkWNCnuNv531l94GaIzO+XI=github.com/jackc/pgx/v5 v5.7.2/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=3 unmodified linesgithub.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=3 unmodified linesgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=3 unmodified linesgithub.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=gorm.io/driver/postgres v1.5.11 h1:ubBVAfbKEUld/twyKZ0IYn9rSQh448EdelLYk9Mv314=gorm.io/driver/postgres v1.5.11/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI=gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8=gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
2 unmodified lines3456789102 unmodified linesimport ("fmt""go-dp.abdanhafidz.com/config""go-dp.abdanhafidz.com/router")func main() {2 unmodified lines3456789102 unmodified linesimport ("fmt""api.qobiltu.id/config""api.qobiltu.id/router")func main() {
5 unmodified lines678910111213141535 unmodified lines51525354555657584 unmodified lines6364656667686970717273747576777879808182838485868788899091929394955 unmodified lines"errors""time""github.com/dgrijalva/jwt-go""github.com/gin-gonic/gin""go-dp.abdanhafidz.com/config""go-dp.abdanhafidz.com/models""golang.org/x/crypto/bcrypt")35 unmodified lines}type CustomClaims struct {jwt.StandardClaimsIDUser int `json:"id"`}func VerifyToken(bearer_token string) (int, string, error) {4 unmodified linesif err != nil {return 0, "invalid-token", err}claims, ok := token.Claims.(*CustomClaims)if !ok || !token.Valid {return 0, "invalid-token", err} else if claims.StandardClaims.ExpiresAt != 0 && claims.ExpiresAt < time.Now().Unix() {return 0, "expired", err} else if !ok && token.Valid {return 0, "invalid-token", err}return claims.IDUser, "valid", err}func AuthUser(c *gin.Context) {var currAccData models.AccountDataif c.Request.Header["Auth-Bearer-Token"] != nil {token := c.Request.Header["Auth-Bearer-Token"]currAccData.IdUser, currAccData.VerifyStatus, currAccData.ErrVerif = VerifyToken(token[0])// fmt.Println("Verify Status :", currAccData.verifyStatus)if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.IdUser = 0message := "Your session is expired, Please re-Login!"SendJSON401(c, &currAccData.VerifyStatus, &message)c.Abort()return}} else {currAccData.IdUser = 0currAccData.VerifyStatus = "no-token"currAccData.ErrVerif = nilmessage := "You have to Login First!"5 unmodified lines678910111213141535 unmodified lines51525354555657584 unmodified lines636465666768697071727374757677787980818283848586878889909192939495965 unmodified lines"errors""time""api.qobiltu.id/config""api.qobiltu.id/models""github.com/gin-gonic/gin""github.com/golang-jwt/jwt/v5""golang.org/x/crypto/bcrypt")35 unmodified lines}type CustomClaims struct {jwt.RegisteredClaimsUserID int `json:"id"`}func VerifyToken(bearer_token string) (int, string, error) {4 unmodified linesif err != nil {return 0, "invalid-token", err}// Extract the claimsclaims, ok := token.Claims.(*CustomClaims)if !ok || !token.Valid {return 0, "invalid-token", err}if claims.ExpiresAt != nil && claims.ExpiresAt.Time.Before(time.Now()) {return 0, "expired", err}return claims.UserID, "valid", err}func AuthUser(c *gin.Context) {var currAccData models.AccountDataif c.Request.Header["Auth-Bearer-Token"] != nil {token := c.Request.Header["Auth-Bearer-Token"]currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = VerifyToken(token[0])// fmt.Println("Verify Status :", currAccData.verifyStatus)if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.UserID = 0message := "Your session is expired, Please re-Login!"SendJSON401(c, &currAccData.VerifyStatus, &message)c.Abort()return}} else {currAccData.UserID = 0currAccData.VerifyStatus = "no-token"currAccData.ErrVerif = nilmessage := "You have to Login First!"
1234567package repositoriesimport ("go-dp.abdanhafidz.com/models")func GetAccountbyEmail(email string) Repository[models.Account, models.Account] {1234567package repositoriesimport ("api.qobiltu.id/models")func GetAccountbyEmail(email string) Repository[models.Account, models.Account] {
12345package repositoriesimport "go-dp.abdanhafidz.com/config"var db = config.DB12345package repositoriesimport "api.qobiltu.id/config"var db = config.DB
1234567package repositoriesimport ("go-dp.abdanhafidz.com/config""gorm.io/gorm")1234567package repositoriesimport ("api.qobiltu.id/config""gorm.io/gorm")
123456789package routerimport ("github.com/gin-gonic/gin""go-dp.abdanhafidz.com/config""go-dp.abdanhafidz.com/controller")func StartService() {123456789package routerimport ("api.qobiltu.id/config""api.qobiltu.id/controller""github.com/gin-gonic/gin")func StartService() {
2 unmodified lines345678910112 unmodified linesimport ("errors""go-dp.abdanhafidz.com/middleware""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/repositories")type LoginConstructor struct {2 unmodified lines345678910112 unmodified linesimport ("errors""api.qobiltu.id/middleware""api.qobiltu.id/models""api.qobiltu.id/repositories")type LoginConstructor struct {
2 unmodified lines34567891011122 unmodified linesimport ("errors"uuid "github.com/satori/go.uuid""go-dp.abdanhafidz.com/middleware""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/repositories""gorm.io/gorm")2 unmodified lines34567891011122 unmodified linesimport ("errors""api.qobiltu.id/middleware""api.qobiltu.id/models""api.qobiltu.id/repositories"uuid "github.com/satori/go.uuid""gorm.io/gorm")
12345614 unmodified lines21222324252627package servicesimport "go-dp.abdanhafidz.com/models"type (Services interface {14 unmodified lines)func Construct[TConstructor any, TResult any](constructor ...TConstructor) *Service[TConstructor, TResult] {if len(constructor) == 0 {return &Service[TConstructor, TResult]{}}12345614 unmodified lines21222324252627package servicesimport "api.qobiltu.id/models"type (Services interface {14 unmodified lines)func Construct[TConstructor any, TResult any](constructor ...TConstructor) *Service[TConstructor, TResult] {if len(constructor) == 1 {return &Service[TConstructor, TResult]{}}
1234567891011package modelstype Exception struct {Unauthorized bool `json:"unauthorized,omitempty"`BadRequest bool `json:"bad_request,omitempty"`DataNotFound bool `json:"data_not_found,omitempty"`InternalServerError bool `json:"internal_server_error,omitempty"`DataDuplicate bool `json:"data_duplicate,omitempty"`QueryError bool `json:"query_error,omitempty"`Message string `json:"message,omitempty"`}123456789101112package modelstype Exception struct {Unauthorized bool `json:"unauthorized,omitempty"`BadRequest bool `json:"bad_request,omitempty"`DataNotFound bool `json:"data_not_found,omitempty"`InternalServerError bool `json:"internal_server_error,omitempty"`DataDuplicate bool `json:"data_duplicate,omitempty"`QueryError bool `json:"query_error,omitempty"`InvalidPasswordLength bool `json:"invalid_password_length,omitempty"`Message string `json:"message,omitempty"`}
14 unmodified lines15161718192014 unmodified lines}func (s *RegisterService) Create() {hashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)s.Error = err_hashs.Constructor.Password = hashed_password14 unmodified lines151617181920212223242514 unmodified lines}func (s *RegisterService) Create() {if len(s.Constructor.Password) < 8 {s.Exception.InvalidPasswordLength = trues.Exception.Message = "Password must have at least 8 characters!"return}hashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)s.Error = err_hashs.Constructor.Password = hashed_password
3 unmodified lines4567891011123 unmodified lines"go-dp.abdanhafidz.com/models")func GetAccountbyEmailPassword(email string, password string) Repository[models.Account, models.Account] {repo := Construct[models.Account, models.Account](models.Account{Email: email, Password: password},)repo.Transactions(WhereGivenConstructor[models.Account, models.Account],3 unmodified lines4567891011123 unmodified lines"go-dp.abdanhafidz.com/models")func GetAccountbyEmail(email string) Repository[models.Account, models.Account] {repo := Construct[models.Account, models.Account](models.Account{Email: email},)repo.Transactions(WhereGivenConstructor[models.Account, models.Account],
1234567842 unmodified lines515253545556575859606162636465package repositoriesimport ("strconv""go-dp.abdanhafidz.com/config""gorm.io/gorm")42 unmodified lines}}func (repo *Repository[T1, T2]) Transactions(transactions ...func(*Repository[T1, T2]) *gorm.DB) {i := 1for _, tx := range transactions {repo.Transaction = tx(repo)if repo.RowsError != nil {repo.Transaction.Rollback()return} else {repo.Transaction.SavePoint("Save Point : " + strconv.Itoa(i))repo.Transaction.Commit()}}}12345642 unmodified lines49505152535455565758package repositoriesimport ("go-dp.abdanhafidz.com/config""gorm.io/gorm")42 unmodified lines}}func (repo *Repository[T1, T2]) Transactions(transactions ...func(*Repository[T1, T2]) *gorm.DB) {for _, tx := range transactions {repo.Transaction = tx(repo)if repo.RowsError != nil {return}}}
17 unmodified lines1819202122232417 unmodified lines}func (s *AuthenticationService) Authenticate() {accountData := repositories.GetAccountbyEmailPassword(s.Constructor.Email, s.Constructor.Password)if accountData.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "there is no account with given credentials!"17 unmodified lines1819202122232417 unmodified lines}func (s *AuthenticationService) Authenticate() {accountData := repositories.GetAccountbyEmail(s.Constructor.Email)if accountData.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "there is no account with given credentials!"
2 unmodified lines3456788 unmodified lines1718192021222 unmodified linesimport ("errors""go-dp.abdanhafidz.com/middleware""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/repositories"8 unmodified lineshashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)s.Error = err_hashs.Constructor.Password = hashed_passwordaccountCreated := repositories.CreateAccount(s.Constructor)if errors.Is(accountCreated.RowsError, gorm.ErrDuplicatedKey) {s.Exception.DataDuplicate = true2 unmodified lines34567898 unmodified lines181920212223242 unmodified linesimport ("errors"uuid "github.com/satori/go.uuid""go-dp.abdanhafidz.com/middleware""go-dp.abdanhafidz.com/models""go-dp.abdanhafidz.com/repositories"8 unmodified lineshashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)s.Error = err_hashs.Constructor.Password = hashed_passwords.Constructor.UUID = uuid.NewV4()accountCreated := repositories.CreateAccount(s.Constructor)if errors.Is(accountCreated.RowsError, gorm.ErrDuplicatedKey) {s.Exception.DataDuplicate = true
35 unmodified lines36373839404135 unmodified linesgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.1.0 // indirectgithub.com/rogpeppe/go-internal v1.11.0 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.11 // indirectgolang.org/x/arch v0.6.0 // indirect35 unmodified lines3637383940414235 unmodified linesgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.1.0 // indirectgithub.com/rogpeppe/go-internal v1.11.0 // indirectgithub.com/satori/go.uuid v1.2.0 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.11 // indirectgolang.org/x/arch v0.6.0 // indirect
78 unmodified lines79808182838478 unmodified linesgithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=78 unmodified lines798081828384858678 unmodified linesgithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
1 unmodified line234567891011121314156 unmodified lines2223242526271 unmodified lineimport ("time")type Account struct {Id uint `gorm:"primaryKey" json:"id"`Email string `gorm:"uniqueIndex" json:"email"`Password string `json:"password"`CreatedAt time.Time `json:"created_at"`DeletedAt time.Time `json:"deleted_at"`}type AccountDetails struct {6 unmodified linesDeletedAt time.Time `json:"deleted_at"`}// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }1 unmodified line23456789101112131415161718196 unmodified lines26272829303132333435363738391 unmodified lineimport ("time"uuid "github.com/satori/go.uuid")type Account struct {Id uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `Email string `gorm:"uniqueIndex" json:"email"`Password string `json:"password"`IsEmailVerified bool `json:"is_email_verified"`CreatedAt time.Time `json:"created_at"`DeletedAt time.Time `json:"deleted_at"`}type AccountDetails struct {6 unmodified linesDeletedAt time.Time `json:"deleted_at"`}type EmailVerification struct {Id int `gorm:"primaryKey" json:"id"`AccountId int `json:"account_id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `CreatedAt time.Time `json:"created_at"`ExpiredAt time.Time `json:"expired_at"`}// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }
123456781 unmodified line10111213141516package repositoriesimport ("fmt""go-dp.abdanhafidz.com/models")1 unmodified linerepo := Construct[models.Account, models.Account](models.Account{Email: email, Password: password},)fmt.Println(repo.Constructor)repo.Transactions(WhereGivenConstructor[models.Account, models.Account],Find[models.Account, models.Account],1234561 unmodified line8910111213package repositoriesimport ("go-dp.abdanhafidz.com/models")1 unmodified linerepo := Construct[models.Account, models.Account](models.Account{Email: email, Password: password},)repo.Transactions(WhereGivenConstructor[models.Account, models.Account],Find[models.Account, models.Account],
13 unmodified lines141516171819205 unmodified lines2627282930313213 unmodified lines}func (s *RegisterService) Create() {hashed_password, _ := middleware.HashPassword(s.Constructor.Password)s.Constructor.Password = hashed_passwordaccountCreated := repositories.CreateAccount(s.Constructor)if errors.Is(accountCreated.RowsError, gorm.ErrDuplicatedKey) {5 unmodified liness.Exception.Message = "Bad request!"return}s.Result = accountCreated.Results.Result.Password = "SECRET"}13 unmodified lines14151617181920215 unmodified lines2728293031323313 unmodified lines}func (s *RegisterService) Create() {hashed_password, err_hash := middleware.HashPassword(s.Constructor.Password)s.Error = err_hashs.Constructor.Password = hashed_passwordaccountCreated := repositories.CreateAccount(s.Constructor)if errors.Is(accountCreated.RowsError, gorm.ErrDuplicatedKey) {5 unmodified liness.Exception.Message = "Bad request!"return}s.Error = accountCreated.RowsErrors.Result = accountCreated.Results.Result.Password = "SECRET"}
LICENSEAdded+201
README.md+71-8
space/.github/workflows/main.yml+1-1
space/space/.github/workflows/main.yml+1-1
space/space/space/.gitignore+2-1
space/space/space/config/config.goAdded+21
space/space/space/config/database_connection_config.goAdded+60
space/space/space/controller/home_controller.goAdded+9
space/space/space/controller/login_controller.goAdded+19
space/space/space/controller/register_controller.goAdded+19
space/space/space/middleware/authentication_middleware.goAdded+104
space/space/space/middleware/response_middleware.goAdded+39
space/space/space/models/authentication_payload_model.goAdded+7
space/space/space/models/database_orm_model.goAdded+31
space/space/space/models/exception_model.goAdded+12
space/space/space/models/model.goAdded+1
space/space/space/models/request_model.goAdded+13
space/space/space/models/response_model.goAdded+19
space/space/space/repositories/account_repository.goAdded+24
space/space/space/repositories/repository.goAdded+113
space/space/space/services/login_service.goAdded+47
space/space/space/services/register_service.goAdded+40
space/space/space/services/service.goAdded+31
space/space/space/space/README.md+71-8
space/space/space/space/config/DatabaseConfig.go+17-17
space/space/space/space/controller/LoginController.go+2-2
space/space/space/space/controller/RegisterController.go+2-2
space/space/space/space/controller/controller.go+3-3
space/space/space/space/go.mod+26-26
space/space/space/space/go.sum+50-72
space/space/space/space/main.go+2-2
space/space/space/space/middleware/AuthMiddleware.go+13-12
space/space/space/space/repositories/AccountRepository.go+1-1
space/space/space/space/repositories/DatabaseScoope.go+1-1
space/space/space/space/repositories/repositories.go+1-1
space/space/space/space/router/router.go+2-2
space/space/space/space/services/LoginService.go+3-3
space/space/space/space/services/RegisterService.go+3-3
space/space/space/space/services/services.go+2-2
space/space/space/space/space/models/ExceptionModel.go+8-7
space/space/space/space/space/services/RegisterService.go+5
space/space/space/space/space/space/repositories/AccountRepository.go+2-2
space/space/space/space/space/space/repositories/repositories.go-7
space/space/space/space/space/space/services/LoginService.go+1-1
space/space/space/space/space/space/services/RegisterService.go+2
space/space/space/space/space/space/space/go.mod+1
space/space/space/space/space/space/space/go.sum+2
space/space/space/space/space/space/space/models/DatabaseModel.go+17-5
space/space/space/space/space/space/space/repositories/AccountRepository.go-3
space/space/space/space/space/space/space/services/RegisterService.go+3-2