feat: implement project repository with Redis caching and transaction support
All checks were successful
Build and Release / release (push) Successful in 1m36s

This commit is contained in:
2026-05-14 13:37:37 +07:00
parent a5a597f2a1
commit 27e9dacf19
2 changed files with 12 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ services:
image: azenkain/postgres-postgis-pgvector:18
container_name: history_db
restart: unless-stopped
env_file:
- ./assets/resources/.env
environment:
@@ -10,6 +11,8 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- PGDATA=/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
- history_db_data:/var/lib/postgresql/data
healthcheck:

View File

@@ -360,6 +360,9 @@ func (r *projectRepository) AddMember(ctx context.Context, params sqlc.AddProjec
if err != nil {
return err
}
go func() {
_ = r.c.DelByPattern(context.Background(), "project:user*")
}()
_ = r.c.Del(ctx, fmt.Sprintf("project:id:%s", convert.UUIDToString(params.ProjectID)))
_ = r.c.Del(ctx, fmt.Sprintf("project:perm:%s:%s", convert.UUIDToString(params.ProjectID), convert.UUIDToString(params.UserID)))
return nil
@@ -370,6 +373,9 @@ func (r *projectRepository) UpdateMemberRole(ctx context.Context, params sqlc.Up
if err != nil {
return err
}
go func() {
_ = r.c.DelByPattern(context.Background(), "project:user*")
}()
_ = r.c.Del(ctx, fmt.Sprintf("project:id:%s", convert.UUIDToString(params.ProjectID)))
_ = r.c.Del(ctx, fmt.Sprintf("project:perm:%s:%s", convert.UUIDToString(params.ProjectID), convert.UUIDToString(params.UserID)))
return nil
@@ -380,6 +386,9 @@ func (r *projectRepository) RemoveMember(ctx context.Context, params sqlc.Remove
if err != nil {
return err
}
go func() {
_ = r.c.DelByPattern(context.Background(), "project:user*")
}()
_ = r.c.Del(ctx, fmt.Sprintf("project:id:%s", convert.UUIDToString(params.ProjectID)))
_ = r.c.Del(ctx, fmt.Sprintf("project:perm:%s:%s", convert.UUIDToString(params.ProjectID), convert.UUIDToString(params.UserID)))
return nil