Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
883ff8b7d1 | ||
|
|
750a4dc3db | ||
|
|
13a8481f22 | ||
|
|
642566c8b2 | ||
|
|
afe6f4e9a6 | ||
|
|
20c9660c3a |
+3
-1
@@ -1,4 +1,6 @@
|
||||
FROM golang:1.24 AS build
|
||||
FROM golang:1.20-alpine AS build
|
||||
|
||||
RUN apk --no-cache add tzdata
|
||||
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
|
||||
@@ -148,6 +148,12 @@ make run
|
||||
|
||||
This command will compile and execute your Go application.
|
||||
|
||||
Or you can execute the compiled binary at `bin/legalgo` by:
|
||||
|
||||
```bash
|
||||
./bin/legalgo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Note:** Ensure that your `Makefile` is correctly set up to handle these commands. If not, you may need to create
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
YAML_PATH = "env/%s"
|
||||
YAML_PATH = "%s"
|
||||
ENV_MODE = "ENV_MODE"
|
||||
DEFAULT_ENV_MODE = "development"
|
||||
)
|
||||
|
||||
@@ -5,10 +5,11 @@ import (
|
||||
)
|
||||
|
||||
type Staff struct {
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"default:null;unique" json:"username"`
|
||||
Email string `gorm:"unique;not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"default:null;unique" json:"name"`
|
||||
ProfilePicture string `gorm:"default:null" json:"profile_picture"`
|
||||
Email string `gorm:"unique;not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ func UpdateStaff(
|
||||
ID: id,
|
||||
Email: spec.Email,
|
||||
Password: spec.Password,
|
||||
Username: spec.Username,
|
||||
Name: spec.Name,
|
||||
}
|
||||
|
||||
if err := authSvc.UpdateStaff(staff); err != nil {
|
||||
@@ -64,9 +64,9 @@ func UpdateStaff(
|
||||
return
|
||||
}
|
||||
|
||||
responsePayload := struct{
|
||||
responsePayload := struct {
|
||||
Message string
|
||||
} {
|
||||
}{
|
||||
Message: "update staff success",
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@ type LoginRepoResponse struct {
|
||||
}
|
||||
|
||||
type StaffProfile struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Username string `json:"username"`
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
ProfilePicture string `json:"profile_picture"`
|
||||
}
|
||||
|
||||
type UserProfile struct {
|
||||
|
||||
@@ -16,20 +16,22 @@ type User struct {
|
||||
}
|
||||
|
||||
type RegisterStaffReq struct {
|
||||
Email string `json:"email" validate:"required"`
|
||||
Password string `json:"password" validate:"required"`
|
||||
Username string `json:"username" validate:"required"`
|
||||
Email string `json:"email" validate:"required"`
|
||||
Password string `json:"password" validate:"required"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
ProfilePicture string `json:"profile_picture"`
|
||||
}
|
||||
|
||||
type UpdateStaffReq struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type Staff struct {
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Username string `json:"username"`
|
||||
ID string `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Name string `json:"name"`
|
||||
ProfilePicture string `json:"profile_picture"`
|
||||
}
|
||||
|
||||
@@ -9,9 +9,10 @@ func (as *AuthSvc) GetStaffProfile(email string) (*authdomain.StaffProfile, erro
|
||||
}
|
||||
|
||||
profile := &authdomain.StaffProfile{
|
||||
ID: staff.ID,
|
||||
Username: staff.Username,
|
||||
Email: staff.Email,
|
||||
ID: staff.ID,
|
||||
Name: staff.Name,
|
||||
Email: staff.Email,
|
||||
ProfilePicture: staff.ProfilePicture,
|
||||
}
|
||||
|
||||
return profile, nil
|
||||
|
||||
@@ -20,10 +20,11 @@ func (a *AuthSvc) RegisterStaff(spec authdomain.RegisterStaffReq) (string, error
|
||||
}
|
||||
|
||||
staff := authdomain.Staff{
|
||||
ID: uuid.NewString(),
|
||||
Email: spec.Email,
|
||||
Password: hashedPwd,
|
||||
Username: spec.Username,
|
||||
ID: uuid.NewString(),
|
||||
Email: spec.Email,
|
||||
Password: hashedPwd,
|
||||
Name: spec.Name,
|
||||
ProfilePicture: spec.ProfilePicture,
|
||||
}
|
||||
|
||||
_, err = a.staffRepo.Create(&staff)
|
||||
|
||||
@@ -20,7 +20,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
volumeMounts:
|
||||
- mountPath: "/env"
|
||||
- mountPath: "/"
|
||||
name: legalgonews-backend-secret
|
||||
readOnly: true
|
||||
volumes:
|
||||
|
||||
@@ -18,7 +18,7 @@ spec:
|
||||
service:
|
||||
name: legalgonews-backend
|
||||
port:
|
||||
number: 3000
|
||||
number: 3300
|
||||
tls:
|
||||
- hosts:
|
||||
- "legalgonews-be.app-dev.altru.id"
|
||||
|
||||
@@ -7,9 +7,9 @@ metadata:
|
||||
run: legalgonews-backend
|
||||
spec:
|
||||
ports:
|
||||
- port: 3000
|
||||
- port: 3300
|
||||
protocol: TCP
|
||||
targetPort: 3000
|
||||
targetPort: 3300
|
||||
selector:
|
||||
app: legalgonews-backend
|
||||
type: ClusterIP
|
||||
|
||||
+7
-3
@@ -25,7 +25,9 @@ paths:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
username:
|
||||
name:
|
||||
type: string
|
||||
profile_picture:
|
||||
type: string
|
||||
"400":
|
||||
description: Bad request
|
||||
@@ -108,12 +110,14 @@ paths:
|
||||
format: email
|
||||
password:
|
||||
type: string
|
||||
username:
|
||||
name:
|
||||
type: string
|
||||
profile_picture:
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- username
|
||||
- name
|
||||
responses:
|
||||
"201":
|
||||
description: Staff member created
|
||||
|
||||
Reference in New Issue
Block a user