Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30091f3362 | ||
|
|
ed8c523b26 | ||
|
|
e9b9a367a9 |
+22
@@ -0,0 +1,22 @@
|
|||||||
|
FROM golang:1.24 AS build
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# RUN CGO_ENABLED=0 GOOS=linux go build -o /app cmd/klinik-core-service
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /app cmd/legalgo/main.go
|
||||||
|
|
||||||
|
RUN ls -la /
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/static
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
COPY --from=build /app /app
|
||||||
|
|
||||||
|
# RUN ls -la /
|
||||||
|
|
||||||
|
ENV TZ=Asia/Jakarta
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app"]
|
||||||
@@ -148,12 +148,6 @@ make run
|
|||||||
|
|
||||||
This command will compile and execute your Go application.
|
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
|
**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 (
|
const (
|
||||||
YAML_PATH = "%s"
|
YAML_PATH = "env/%s"
|
||||||
ENV_MODE = "ENV_MODE"
|
ENV_MODE = "ENV_MODE"
|
||||||
DEFAULT_ENV_MODE = "development"
|
DEFAULT_ENV_MODE = "development"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import (
|
|||||||
|
|
||||||
type Staff struct {
|
type Staff struct {
|
||||||
ID string `gorm:"primaryKey" json:"id"`
|
ID string `gorm:"primaryKey" json:"id"`
|
||||||
Name string `gorm:"default:null;unique" json:"name"`
|
Username string `gorm:"default:null;unique" json:"username"`
|
||||||
ProfilePicture string `gorm:"default:null" json:"profile_picture"`
|
|
||||||
Email string `gorm:"unique;not null" json:"email"`
|
Email string `gorm:"unique;not null" json:"email"`
|
||||||
Password string `gorm:"not null" json:"password"`
|
Password string `gorm:"not null" json:"password"`
|
||||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func UpdateStaff(
|
|||||||
ID: id,
|
ID: id,
|
||||||
Email: spec.Email,
|
Email: spec.Email,
|
||||||
Password: spec.Password,
|
Password: spec.Password,
|
||||||
Name: spec.Name,
|
Username: spec.Username,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := authSvc.UpdateStaff(staff); err != nil {
|
if err := authSvc.UpdateStaff(staff); err != nil {
|
||||||
@@ -64,9 +64,9 @@ func UpdateStaff(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
responsePayload := struct {
|
responsePayload := struct{
|
||||||
Message string
|
Message string
|
||||||
}{
|
} {
|
||||||
Message: "update staff success",
|
Message: "update staff success",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ type LoginRepoResponse struct {
|
|||||||
type StaffProfile struct {
|
type StaffProfile struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Name string `json:"name"`
|
Username string `json:"username"`
|
||||||
ProfilePicture string `json:"profile_picture"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserProfile struct {
|
type UserProfile struct {
|
||||||
|
|||||||
@@ -18,20 +18,18 @@ type User struct {
|
|||||||
type RegisterStaffReq struct {
|
type RegisterStaffReq struct {
|
||||||
Email string `json:"email" validate:"required"`
|
Email string `json:"email" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Username string `json:"username" validate:"required"`
|
||||||
ProfilePicture string `json:"profile_picture"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateStaffReq struct {
|
type UpdateStaffReq struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Name string `json:"name"`
|
Username string `json:"username"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Staff struct {
|
type Staff struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Name string `json:"name"`
|
Username string `json:"username"`
|
||||||
ProfilePicture string `json:"profile_picture"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ func (as *AuthSvc) GetStaffProfile(email string) (*authdomain.StaffProfile, erro
|
|||||||
|
|
||||||
profile := &authdomain.StaffProfile{
|
profile := &authdomain.StaffProfile{
|
||||||
ID: staff.ID,
|
ID: staff.ID,
|
||||||
Name: staff.Name,
|
Username: staff.Username,
|
||||||
Email: staff.Email,
|
Email: staff.Email,
|
||||||
ProfilePicture: staff.ProfilePicture,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return profile, nil
|
return profile, nil
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ func (a *AuthSvc) RegisterStaff(spec authdomain.RegisterStaffReq) (string, error
|
|||||||
ID: uuid.NewString(),
|
ID: uuid.NewString(),
|
||||||
Email: spec.Email,
|
Email: spec.Email,
|
||||||
Password: hashedPwd,
|
Password: hashedPwd,
|
||||||
Name: spec.Name,
|
Username: spec.Username,
|
||||||
ProfilePicture: spec.ProfilePicture,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = a.staffRepo.Create(&staff)
|
_, err = a.staffRepo.Create(&staff)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: "/"
|
- mountPath: "/env"
|
||||||
name: legalgonews-backend-secret
|
name: legalgonews-backend-secret
|
||||||
readOnly: true
|
readOnly: true
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
service:
|
service:
|
||||||
name: legalgonews-backend
|
name: legalgonews-backend
|
||||||
port:
|
port:
|
||||||
number: 3300
|
number: 3000
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- "legalgonews-be.app-dev.altru.id"
|
- "legalgonews-be.app-dev.altru.id"
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ metadata:
|
|||||||
run: legalgonews-backend
|
run: legalgonews-backend
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 3300
|
- port: 3000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 3300
|
targetPort: 3000
|
||||||
selector:
|
selector:
|
||||||
app: legalgonews-backend
|
app: legalgonews-backend
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
|
|||||||
+3
-7
@@ -25,9 +25,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
email:
|
email:
|
||||||
type: string
|
type: string
|
||||||
name:
|
username:
|
||||||
type: string
|
|
||||||
profile_picture:
|
|
||||||
type: string
|
type: string
|
||||||
"400":
|
"400":
|
||||||
description: Bad request
|
description: Bad request
|
||||||
@@ -110,14 +108,12 @@ paths:
|
|||||||
format: email
|
format: email
|
||||||
password:
|
password:
|
||||||
type: string
|
type: string
|
||||||
name:
|
username:
|
||||||
type: string
|
|
||||||
profile_picture:
|
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- email
|
- email
|
||||||
- password
|
- password
|
||||||
- name
|
- username
|
||||||
responses:
|
responses:
|
||||||
"201":
|
"201":
|
||||||
description: Staff member created
|
description: Staff member created
|
||||||
|
|||||||
Reference in New Issue
Block a user