-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
110 lines (82 loc) · 3.5 KB
/
Copy pathMakefile
File metadata and controls
110 lines (82 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Load environment variables from .env file
### === Start Services ===
start-user-svc:
cd user-svc/cmd/web && go run main.go
start-photo-svc:
cd photo-svc/cmd/web && go run main.go
start-upload-svc:
cd upload-svc/cmd/web && go run main.go
start-transaction-svc:
cd transaction-svc/cmd/web && go run main.go
start-notification-worker:
cd notification-svc/cmd/worker && go run main.go
include .env
# expor
.PHONY: all proto migrate-up migrate-down \
photo-svc-migrate-up photo-svc-migrate-down photo-svc-migrate-reset \
user-svc-migrate-up user-svc-migrate-down user-svc-migrate-reset \
transaction-svc-migrate-up transaction-svc-migrate-down transaction-svc-migrate-reset \
start-photo-svc start-upload-svc start-user-svc start-transaction-svc \
mockgen-upload-svc
### === Migration Template ===
migrate-up:
@echo "⚠️ Please set DB_URL when calling this target, e.g., make migrate-up DB_URL=$(USER_DB_URL)"
goose -dir $(MIGRATIONS_DIR) postgres "$(DB_URL)" up
migrate-down:
@echo "⚠️ Please set DB_URL when calling this target, e.g., make migrate-down DB_URL=$(USER_DB_URL)"
goose -dir $(MIGRATIONS_DIR) postgres "$(DB_URL)" down
### === User Service Migration ===
user-svc-migrate-up:
cd user-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(USER_DB_URL)" up
user-svc-migrate-down:
cd user-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(USER_DB_URL)" down
user-svc-migrate-reset:
cd user-svc && \
goose -dir $(MIGRATIONS_DIR) postgres "$(USER_DB_URL)" down-to 0 && \
goose -dir $(MIGRATIONS_DIR) postgres "$(USER_DB_URL)" up
### === Photo Service Migration ===
photo-svc-migrate-up:
cd photo-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(PHOTO_DB_URL)" up
photo-svc-migrate-down:
cd photo-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(PHOTO_DB_URL)" down
photo-svc-migrate-reset:
cd photo-svc && \
goose -dir $(MIGRATIONS_DIR) postgres "$(PHOTO_DB_URL)" down-to 0 && \
goose -dir $(MIGRATIONS_DIR) postgres "$(PHOTO_DB_URL)" up
### === Transaction Service Migration ===
transaction-svc-migrate-up:
cd transaction-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(TRANSACTION_DB_URL)" up
transaction-svc-migrate-down:
cd transaction-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(TRANSACTION_DB_URL)" down
transaction-svc-migrate-reset:
cd transaction-svc && \
goose -dir $(MIGRATIONS_DIR) postgres "$(TRANSACTION_DB_URL)" down-to 0 && \
goose -dir $(MIGRATIONS_DIR) postgres "$(TRANSACTION_DB_URL)" up
### === Notification Service Migration ===
notification-svc-migrate-up:
cd notification-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(NOTIFICATION_DB_URL)" up
notification-svc-migrate-down:
cd notification-svc && goose -dir $(MIGRATIONS_DIR) postgres "$(NOTIFICATION_DB_URL)" down
notification-svc-migrate-reset:
cd notification-svc && \
goose -dir $(MIGRATIONS_DIR) postgres "$(NOTIFICATION_DB_URL)" down-to 0 && \
goose -dir $(MIGRATIONS_DIR) postgres "$(NOTIFICATION_DB_URL)" up
### === Protobuf Compile ===
proto:
cd pb && \
protoc -I=. -I=pb \
--go_out=paths=source_relative:. \
--go-grpc_out=paths=source_relative:. \
$(PROTO_FILE)
### === Mock Generation ===
mockgen-upload-svc:
cd upload-svc/internal && \
mockgen -source=./adapter/user_adapter.go \
-destination=./mocks/adapter/mock_user_adapter.go \
-package=mockadapter
### === Mock Generation ===
mockgen-user-svc:
cd user-svc/internal && \
mockgen -source=./helper/logger/logger.go \
-destination=./mocks/helper/logger/mock_log.go \
-package=mocklogger