Skip to content

Commit a8b08cb

Browse files
committed
feat(project): add service logic, update entity and format code
1 parent 7e5a782 commit a8b08cb

40 files changed

Lines changed: 2374 additions & 445 deletions

.github/workflows/ci.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
name: CI
22

33
on:
4-
pull_request:
5-
branches: [dev, main, "feat/**"]
6-
push:
7-
branches: [dev, main, "feat/**"]
4+
pull_request:
5+
branches: [dev, main, 'feat/**']
6+
push:
7+
branches: [dev, main, 'feat/**']
88

99
jobs:
10-
quality-check:
11-
name: Lint & Test
12-
runs-on: ubuntu-latest
10+
quality-check:
11+
name: Lint & Test
12+
runs-on: ubuntu-latest
1313

14-
steps:
15-
- name: Checkout repository
16-
uses: actions/checkout@v4
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
1717

18-
- name: Install pnpm
19-
uses: pnpm/action-setup@v4
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v4
2020

21-
- name: Setup Node.js
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: 20
25-
cache: "pnpm"
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'pnpm'
2626

27-
- name: Install dependencies
28-
run: pnpm install --frozen-lockfile
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
2929

30-
- name: Run Lint
31-
run: pnpm run lint
30+
- name: Run Lint
31+
run: pnpm run lint
3232

33-
- name: Type Check
34-
run: pnpm exec tsc --noEmit
33+
- name: Type Check
34+
run: pnpm exec tsc --noEmit
3535

36-
- name: Run Tests
37-
run: pnpm run test
36+
- name: Run Tests
37+
run: pnpm run test

.lintstagedrc.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
export default {
2-
'*.{ts,js}': [
3-
'eslint --fix',
4-
'prettier --write'
5-
],
2+
'*.{ts,js}': ['eslint --fix', 'prettier --write'],
63
'*.{json,css,md,yaml,yml}': ['prettier --write'],
74
};

infra/dev/compose.dev.yaml

Lines changed: 105 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,117 @@
1-
version: "3.9"
1+
version: '3.9'
22

33
name: task-tracker-api
44

55
services:
6-
api:
7-
hostname: api
8-
container_name: api
9-
image: ghcr.io/task-tracker-lab/task-tracker-backend:feat-user
10-
env_file:
11-
- .env
12-
ports:
13-
- "3000:3000"
14-
depends_on:
15-
database:
16-
condition: service_healthy
17-
redis:
18-
condition: service_healthy
19-
networks:
20-
- backend
21-
deploy:
22-
resources:
23-
limits:
24-
cpus: "2.0"
25-
memory: 1024M
26-
reservations:
27-
cpus: "0.5"
28-
memory: 256M
6+
api:
7+
hostname: api
8+
container_name: api
9+
image: ghcr.io/task-tracker-lab/task-tracker-backend:feat-user
10+
env_file:
11+
- .env
12+
ports:
13+
- '3000:3000'
14+
depends_on:
15+
database:
16+
condition: service_healthy
17+
redis:
18+
condition: service_healthy
19+
networks:
20+
- backend
21+
deploy:
22+
resources:
23+
limits:
24+
cpus: '2.0'
25+
memory: 1024M
26+
reservations:
27+
cpus: '0.5'
28+
memory: 256M
2929

30-
database:
31-
hostname: database
32-
container_name: database
33-
image: postgres:16-alpine
34-
restart: always
35-
env_file:
36-
- .env
37-
environment:
38-
POSTGRES_USER: ${DB_USERNAME}
39-
POSTGRES_PASSWORD: ${DB_PASSWORD}
40-
POSTGRES_DB: ${DB_DATABASE}
41-
ports:
42-
- "6000:5432"
43-
volumes:
44-
- postgres_data:/var/lib/postgresql/data
45-
networks:
46-
- backend
47-
healthcheck:
48-
test:
49-
[
50-
"CMD-SHELL",
51-
'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -q || exit 1',
52-
]
53-
interval: 5s
54-
timeout: 5s
55-
retries: 5
56-
profiles: ["infra"]
30+
database:
31+
hostname: database
32+
container_name: database
33+
image: postgres:16-alpine
34+
restart: always
35+
env_file:
36+
- .env
37+
environment:
38+
POSTGRES_USER: ${DB_USERNAME}
39+
POSTGRES_PASSWORD: ${DB_PASSWORD}
40+
POSTGRES_DB: ${DB_DATABASE}
41+
ports:
42+
- '6000:5432'
43+
volumes:
44+
- postgres_data:/var/lib/postgresql/data
45+
networks:
46+
- backend
47+
healthcheck:
48+
test: ['CMD-SHELL', 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" -q || exit 1']
49+
interval: 5s
50+
timeout: 5s
51+
retries: 5
52+
profiles: ['infra']
5753

58-
redis:
59-
hostname: redis
60-
container_name: redis
61-
image: redis:7-alpine
62-
restart: always
63-
ports:
64-
- "7000:6379"
65-
command: redis-server --save 60 1 --loglevel notice
66-
volumes:
67-
- redis_data:/data
68-
networks:
69-
- backend
70-
healthcheck:
71-
test: ["CMD", "redis-cli", "ping"]
72-
interval: 5s
73-
timeout: 3s
74-
retries: 5
75-
profiles: ["infra"]
54+
redis:
55+
hostname: redis
56+
container_name: redis
57+
image: redis:7-alpine
58+
restart: always
59+
ports:
60+
- '7000:6379'
61+
command: redis-server --save 60 1 --loglevel notice
62+
volumes:
63+
- redis_data:/data
64+
networks:
65+
- backend
66+
healthcheck:
67+
test: ['CMD', 'redis-cli', 'ping']
68+
interval: 5s
69+
timeout: 3s
70+
retries: 5
71+
profiles: ['infra']
7672

77-
minio:
78-
hostname: minio
79-
container_name: minio
80-
image: minio/minio:latest
81-
restart: always
82-
environment:
83-
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
84-
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
85-
ports:
86-
- "9000:9000" # API
87-
- "9001:9001" # Console (UI)
88-
command: server /data --console-address ":9001"
89-
volumes:
90-
- minio_data:/data
91-
networks:
92-
- backend
93-
profiles: [ "infra" ]
73+
minio:
74+
hostname: minio
75+
container_name: minio
76+
image: minio/minio:latest
77+
restart: always
78+
environment:
79+
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
80+
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
81+
ports:
82+
- '9000:9000' # API
83+
- '9001:9001' # Console (UI)
84+
command: server /data --console-address ":9001"
85+
volumes:
86+
- minio_data:/data
87+
networks:
88+
- backend
89+
profiles: ['infra']
9490

95-
minio-init:
96-
image: minio/mc:latest
97-
depends_on:
98-
- minio
99-
environment:
100-
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
101-
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
102-
networks:
103-
- backend
104-
profiles: [ "infra" ]
105-
entrypoint: >
106-
/bin/sh -c "
107-
sleep 5;
108-
mc alias set myminio http://minio:9000 ${S3_ACCESS_KEY} ${S3_SECRET_KEY};
109-
mc mb myminio/${S3_BUCKET_NAME} --ignore-existing;
110-
mc anonymous set download myminio/${S3_BUCKET_NAME};
111-
exit 0;
112-
"
91+
minio-init:
92+
image: minio/mc:latest
93+
depends_on:
94+
- minio
95+
environment:
96+
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
97+
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
98+
networks:
99+
- backend
100+
profiles: ['infra']
101+
entrypoint: >
102+
/bin/sh -c "
103+
sleep 5;
104+
mc alias set myminio http://minio:9000 ${S3_ACCESS_KEY} ${S3_SECRET_KEY};
105+
mc mb myminio/${S3_BUCKET_NAME} --ignore-existing;
106+
mc anonymous set download myminio/${S3_BUCKET_NAME};
107+
exit 0;
108+
"
113109
114110
volumes:
115-
postgres_data:
116-
redis_data:
117-
minio_data:
111+
postgres_data:
112+
redis_data:
113+
minio_data:
118114

119115
networks:
120-
backend:
121-
name: task-tracker-gateway
116+
backend:
117+
name: task-tracker-gateway
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CREATE TABLE
2+
"base"."project_shares" (
3+
"id" text PRIMARY KEY NOT NULL,
4+
"project_id" text NOT NULL,
5+
"token" text NOT NULL,
6+
"expires_at" timestamp
7+
with
8+
time zone,
9+
"created_by" text NOT NULL,
10+
"created_at" timestamp DEFAULT now () NOT NULL,
11+
CONSTRAINT "project_shares_token_unique" UNIQUE ("token")
12+
);
13+
14+
ALTER TABLE "base"."projects"
15+
DROP CONSTRAINT "projects_share_token_unique";
16+
17+
DROP INDEX "base"."project_share_token_idx";
18+
19+
ALTER TABLE "base"."project_shares" ADD CONSTRAINT "project_shares_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "base"."projects" ("id") ON DELETE cascade ON UPDATE no action;
20+
21+
CREATE INDEX "token_idx" ON "base"."project_shares" USING btree ("token");
22+
23+
CREATE INDEX "project_share_project_id_idx" ON "base"."project_shares" USING btree ("project_id");
24+
25+
CREATE UNIQUE INDEX "project_team_name_idx" ON "base"."projects" USING btree ("team_id", "name")
26+
WHERE
27+
"base"."projects"."deleted_at" is null;
28+
29+
ALTER TABLE "base"."projects"
30+
DROP COLUMN "is_publicly_viewable";
31+
32+
ALTER TABLE "base"."projects"
33+
DROP COLUMN "share_token";

0 commit comments

Comments
 (0)