Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global refactoring #5

Merged
merged 142 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
baeed06
refactor: reinitialize project
Mort4lis Oct 8, 2023
b04d78a
chore: improve Makefile
Mort4lis Oct 8, 2023
37fc763
chore: use Makefile while building docker image
Mort4lis Oct 8, 2023
dc10b18
chore: configurate golangci-lint
Mort4lis Oct 13, 2023
7f689bd
chore(log): implement log package (go.uber.org/zap wrapper)
Mort4lis Oct 21, 2023
e8d97bf
chore(log): create context from logger and getting this one from context
Mort4lis Oct 21, 2023
5837941
fix(log): simplify configure logger
Mort4lis Oct 21, 2023
7a5ae5e
chore(db): initialize db schema
Mort4lis Oct 28, 2023
2790a72
chore(api): describe contracts for users, auth
Mort4lis Nov 4, 2023
a3113ae
refactor(db): rename password hash column
Mort4lis Nov 4, 2023
2464adc
fix: fix linter warnings
Mort4lis Nov 4, 2023
d10a331
chore(api): describe contracts for chats, groups
Mort4lis Nov 4, 2023
0af360e
fix(api): fix path identity types
Mort4lis Nov 4, 2023
40a2747
refactor(api): rename path constants for user api
Mort4lis Nov 4, 2023
74dca83
refactor(db): rename chats to conversations, members to participants
Mort4lis Nov 5, 2023
e1eb20c
refactor(api): rename chats to conversations
Mort4lis Nov 5, 2023
ae2519c
fix(api): fix conversation api
Mort4lis Nov 5, 2023
c3d9339
refactor(api): move create methods between list and detail
Mort4lis Nov 5, 2023
2db049e
chore(api): describe contracts for group participants
Mort4lis Nov 5, 2023
23f860c
fix(db): move service content type to the separate `is_service` field
Mort4lis Nov 5, 2023
2577592
chore(api): describe contracts for messages
Mort4lis Nov 5, 2023
2c9556e
docs(swagger): regenerate swagger
Mort4lis Nov 5, 2023
d18eb30
refactor(api): remove prefix `Detail` for response models
Mort4lis Nov 5, 2023
bbcc99b
docs(swagger): regenerate swagger
Mort4lis Nov 5, 2023
e023999
fix: fix linter warnings
Mort4lis Nov 5, 2023
b343b20
fix(api): fix describe body to update for conversation endpoint
Mort4lis Nov 5, 2023
521ae45
docs(swagger): regenerate swagger
Mort4lis Nov 5, 2023
613f1f5
fix(db): reworked database schema
Mort4lis Jan 3, 2024
d6fd915
fix(api): fix swagger
Mort4lis Jan 3, 2024
3a935fb
chore: remove extra from README.md
Mort4lis Jan 3, 2024
5784509
docs: describe functional and non-functional requirements
Mort4lis Jan 3, 2024
5009a8c
chore: update Description in README.md and move Configuration to How …
Mort4lis Jan 3, 2024
148bd5f
docs: describe basic estimation (rps, traffic, storage)
Mort4lis Jan 3, 2024
a15108d
fix: add /api directory to docker image
Mort4lis Jan 3, 2024
e1cb62a
docs: fix header in docs/README.md
Mort4lis Jan 3, 2024
457b02f
docs: describe database schemas for all systems
Mort4lis Jan 6, 2024
ddde58b
docs: describe container layer
Mort4lis Jan 7, 2024
1eecbab
docs: describe context layer
Mort4lis Jan 7, 2024
2bb6d43
refactor: move dirs for docs/
Mort4lis Jan 7, 2024
7306eb6
docs: fix relation from notification system to user
Mort4lis Jan 7, 2024
bec0e9f
chore: fix link to system design page
Mort4lis Jan 7, 2024
84987de
docs: fix replication type for chat service database
Mort4lis Jan 7, 2024
0b316a5
docs: describe system design overview
Mort4lis Jan 7, 2024
67f8cbc
docs: add relation between Notification System and User for container…
Mort4lis Jan 7, 2024
f82bd2b
chore: implement token generators for jwt and hex
Mort4lis Jan 11, 2024
39756bb
chore: implement service layer for pkg/auth package
Mort4lis Jan 11, 2024
b18b4fb
refactor: refactoring before storage implementation
Mort4lis Jan 11, 2024
31bc394
chore: implement redis storage for pkg/auth
Mort4lis Jan 11, 2024
eb1cc08
chore: increase line-length threshold for golang-ci lint
Mort4lis Jan 12, 2024
46309e8
fix: linter fixes
Mort4lis Jan 12, 2024
a002e31
chore: add storing all users' sessions
Mort4lis Jan 12, 2024
30d6eb1
chore: implement validators for struct and variable
Mort4lis Jan 13, 2024
93d1dd3
chore: implement funcs RespondSuccess and RespondError for pkg/httput…
Mort4lis Jan 13, 2024
19c7adb
chore: implement body and params parsers for pkg/httputil package
Mort4lis Jan 13, 2024
7f0289c
chore: add constructors for validator and parsers
Mort4lis Jan 13, 2024
ed01661
chore: basic implementation of pkg/auth http controller
Mort4lis Jan 13, 2024
4ddb9fe
chore: remove parsers from httputil
Mort4lis Jan 15, 2024
1205276
fix: remove extra userID parameter from pkg/auth package
Mort4lis Jan 15, 2024
1ccbe31
refactor: decouple inner packages within pkg/auth
Mort4lis Jan 15, 2024
f9022b4
docs(api): remove jwt authorization for /auth/logout and /auth/refres…
Mort4lis Jan 15, 2024
c6422ab
fix: fixes bugs for pkg/auth package
Mort4lis Jan 15, 2024
4643b1d
fix: fixes bugs after manual testing
Mort4lis Jan 16, 2024
1a318a3
chore: basic run the application
Mort4lis Jan 16, 2024
7cd627b
chore: ignore strings.SplitN for gomnd
Mort4lis Jan 16, 2024
6743873
test: unit tests for service layer of pkg/auth package
Mort4lis Jan 16, 2024
98dfd8a
chore: mod tidies
Mort4lis Jan 17, 2024
56f9389
test: add unit tests for transport layer of pkg/auth package
Mort4lis Jan 17, 2024
f3ecf26
fix: fix refresh_token cookie path
Mort4lis Jan 17, 2024
ac10a45
chore: update .golangci.yaml
Mort4lis Jan 17, 2024
5e7ae81
chore: implement Authorize middleware
Mort4lis Jan 17, 2024
b24ac29
chore: implement request_id setter middleware
Mort4lis Jan 17, 2024
0b6ca49
chore: implement log middleware
Mort4lis Jan 17, 2024
94dea6a
fix: fix linter warnings
Mort4lis Jan 17, 2024
cd70053
chore: apply set request_id and log middlewares
Mort4lis Jan 17, 2024
36f917b
chore: add swagger endpoint
Mort4lis Jan 17, 2024
4f9c53c
fix: fix swagger spec
Mort4lis Jan 17, 2024
95c171b
chore: apply CORS
Mort4lis Jan 17, 2024
a403d70
chore: add panic and global option handlers
Mort4lis Jan 17, 2024
0835ec6
chore: implement service layer of user api
Mort4lis Jan 18, 2024
d13a02d
chore: add new common errors for httputil package
Mort4lis Jan 18, 2024
ab7b3fe
refactor: replace userID type for func ctxutil.UserIDFromContext
Mort4lis Jan 18, 2024
37327b4
chore: implement transport layer of user api
Mort4lis Jan 18, 2024
f11a147
fix: fix check user password
Mort4lis Jan 19, 2024
6d2a6b7
chore: establishing db conn pool
Mort4lis Jan 19, 2024
4f0f30a
fix: remove is_active user fields, set birth_date as optional
Mort4lis Jan 19, 2024
d41632e
chore: implement repository layer of user api
Mort4lis Jan 19, 2024
4612428
feat: implement view, create, update and delete user profiles
Mort4lis Jan 19, 2024
3ac1fe1
chore: implement delete all user sessions
Mort4lis Jan 19, 2024
996540d
fix: fix error context messages from data access layers
Mort4lis Jan 19, 2024
827d6e0
refactor: remove updatedAt field from entity, format queries in data …
Mort4lis Jan 22, 2024
ecdfabf
docs: remove 404 status code for POST /api/v1/users endpoint
Mort4lis Jan 22, 2024
22ce7c6
feat: group chats support
Mort4lis Jan 22, 2024
5f5bba8
refactor: beatify queries
Mort4lis Jan 22, 2024
bb5a2d2
fix: fix error context messages from data access layers
Mort4lis Jan 23, 2024
297e82c
feat: dialog chats support
Mort4lis Jan 23, 2024
2a43d28
fix: fix validation error returned fields
Mort4lis Jan 23, 2024
1278363
test: add unit tests for transport layer of user api
Mort4lis Jan 23, 2024
4e9c1cd
test: fix request methods for UserController tests
Mort4lis Jan 24, 2024
3ced580
test: add unit tests for transport layer of group api
Mort4lis Jan 24, 2024
9a1e3a5
refactor: rename error name for creating dialog with non-existent user
Mort4lis Jan 24, 2024
d5c21eb
test: add unit tests for transport layer of dialog api
Mort4lis Jan 24, 2024
de3986d
fix: fix linter warnings
Mort4lis Jan 24, 2024
c481a55
refactor: rename dialog errors
Mort4lis Jan 25, 2024
b0e974d
feat: support for inviting/kicking/leaving participants from group
Mort4lis Jan 25, 2024
35083de
fix: change error interface implementation for httputil.Error
Mort4lis Jan 25, 2024
15514b1
refactor: remove duplicate code for service.GroupParticipant
Mort4lis Jan 26, 2024
2678d78
test: cover service.GroupParticipant by unit tests
Mort4lis Jan 26, 2024
c69e962
fix: bug fixes for group participant controller
Mort4lis Jan 26, 2024
514aa7e
test: add unit tests for transport layer of group participant api
Mort4lis Jan 26, 2024
a41bc06
chore: implement service layer of message api
Mort4lis Jan 29, 2024
11389ba
chore: implement repository layer of message api
Mort4lis Jan 29, 2024
9be1e97
chore: implement transaction manager
Mort4lis Jan 29, 2024
24dc44e
feat: support message REST API
Mort4lis Jan 29, 2024
82a900c
chore: implement decoder for parse query, header, path params and body
Mort4lis Jan 29, 2024
945c4d7
refactor: apply new request decoder for messages
Mort4lis Jan 29, 2024
387a7c5
chore: implement message pub/sub
Mort4lis Jan 31, 2024
ad4368c
chore: implement participant event producer/consumer
Mort4lis Jan 31, 2024
c7c5856
chore: add producing events after adding or removing participants, cr…
Mort4lis Jan 31, 2024
276c979
test: update unit tests for group participant service layer
Mort4lis Jan 31, 2024
daa2bc3
chore: implement message serve manager
Mort4lis Jan 31, 2024
f531c86
feat: support message Websocket API
Mort4lis Feb 1, 2024
ad6aba3
test: prepare to integration tests
Mort4lis Feb 1, 2024
193dc54
chore: fix access token ttl in config file
Mort4lis Feb 1, 2024
17922ea
fix: remove logger middleware from websocket.Server
Mort4lis Feb 1, 2024
0ef65aa
test: enrich fixtures
Mort4lis Feb 1, 2024
47bd5f7
test: add methods authenticate and newWebsocketConn for integration t…
Mort4lis Feb 1, 2024
ad8906a
fix: fixes bugs
Mort4lis Feb 2, 2024
9d13658
test: add integration tests for core features
Mort4lis Feb 2, 2024
209ed78
test: add unit tests for transport layer of message api
Mort4lis Feb 2, 2024
2ab6b52
refactor: apply RequestDecoder for all REST resources
Mort4lis Feb 3, 2024
8ab7be8
test: fix tests after refactoring
Mort4lis Feb 3, 2024
88b24fc
refactor: move duplicated server code to httputil package
Mort4lis Feb 3, 2024
1e3f89e
test: fix linter
Mort4lis Feb 3, 2024
57b4618
chore: add default value as now() for created_at fields
Mort4lis Feb 3, 2024
c430d73
chore: set indices
Mort4lis Feb 3, 2024
084e78a
fix: reconstruct query to list messages
Mort4lis Feb 3, 2024
17ad297
chore: describe env variables in config file
Mort4lis Feb 3, 2024
0e46491
chore: change binary name of application for make build
Mort4lis Feb 3, 2024
be8fe62
chore: add installing migrate tool while building docker image
Mort4lis Feb 3, 2024
50aa1f5
chore: describe README.md
Mort4lis Feb 3, 2024
144a158
chore: fix ci
Mort4lis Feb 3, 2024
b68336b
fix: fix lint warnings
Mort4lis Feb 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

!/cmd/**
!/configs/**
!/docs/**
!/db/**
!/api/**
!/internal/**
!/pkg/**

!Makefile
!go.mod
!go.sum
26 changes: 13 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.46
version: v1.54.2

test:
needs: lint
runs-on: ubuntu-latest
env:
TZ: Europe/Moscow
DB_USER: scht_user
DB_PASSWORD: scht_password
DB_NAME: scht_db_test
DB_USER: chatyx_user
DB_PASSWORD: chatyx_password
DB_NAME: chatyx_db_test

services:
postgres:
image: postgres:12.1
image: postgres:15.4
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
Expand All @@ -43,17 +43,17 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- 5433:5432
- 15432:5432

redis:
image: redis:6.2.5
image: redis:7.2
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6380:6379
- 16379:6379

steps:
- name: Check out repository code
Expand All @@ -62,13 +62,13 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.21

- name: Run unit tests
run: go test -tags=unit -v -coverprofile=cover.out ./... && go tool cover -func=cover.out
run: go test -v -coverprofile=cover.out ./internal/... ./pkg/... && go tool cover -func=cover.out

- name: Run integration tests
run: go test -tags=integration -v ./test/...
run: go test -v ./test/... -run TestAppTestSuite

publish:
needs: test
Expand All @@ -91,5 +91,5 @@ jobs:
push: true
context: .
tags: |
mortalis/scht-backend:0.0.1
mortalis/scht-backend:latest
mortalis/chatyx-backend:0.1.0
mortalis/chatyx-backend:latest
25 changes: 12 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# IDE files
.idea/

# VSCode files
.vscode/

# OS files
.DS_Store

# Builds
build/

# Test binary, built with `go test -c`
*.test
# Binary files
bin/

# Output of the go coverage tool
*.out
Expand All @@ -20,8 +22,5 @@ logs/
# Envfile
.env

# IDE files
.idea/

# Volumes
.volumes/
# Storage data (postgres, redis, etc.)
.data/
Loading
Loading