Skip to content

Implement badge service #33

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

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
3834565
create contribution fetching for all users in the system from bigquer…
VishakhaSainani Jun 5, 2025
1c7b715
Merge branch 'feat/db_migrations' into feat/contribution-service
VishakhaSainani Jun 5, 2025
284fdaf
Merge branch 'fix/login-timestamp-type' into feat/contribution-service
VishakhaSainani Jun 9, 2025
d3d91a4
use userid while adding contribution
VishakhaSainani Jun 9, 2025
1c1135f
get id and score from contribution_score
VishakhaSainani Jun 9, 2025
f94000e
fix date format
VishakhaSainani Jun 9, 2025
c865d7a
removed readme.md file changes
AshokaJS Jun 12, 2025
a17215c
refactor processfetchedcontribution function and update http client h…
VishakhaSainani Jun 16, 2025
de13e7a
implement users five recent contributions
VishakhaSainani Jun 17, 2025
f7e8fa9
fetch all contributions for the user
VishakhaSainani Jun 17, 2025
887faa4
remove unnecessary lines
VishakhaSainani Jun 17, 2025
f59627d
implement fetch all contributed repositories of user (my contribution…
VishakhaSainani Jun 18, 2025
8e88ba1
Merge branch 'feat/contribution-service' into feat/repository-service
VishakhaSainani Jun 18, 2025
82afbdd
send all details for the repository
VishakhaSainani Jun 18, 2025
c8da5f1
fetch particular repository details
VishakhaSainani Jun 18, 2025
121d59c
implement fetch particular repo contributors
VishakhaSainani Jun 18, 2025
465fcd4
implement fetch contributions of user in a particular repository
VishakhaSainani Jun 18, 2025
f85a010
fetch particular repository language percentage
VishakhaSainani Jun 19, 2025
bb68dfa
pass http client in service struct
VishakhaSainani Jun 19, 2025
e5a4d0b
add contributors_url in repository table
VishakhaSainani Jun 19, 2025
a8e5768
Merge branch 'db/migration/add-contributors-url' into feat/contributi…
VishakhaSainani Jun 19, 2025
5773245
fetch and contributors url for repository
VishakhaSainani Jun 20, 2025
f365171
remove fetch five recent contributions for the user- this could be ha…
VishakhaSainani Jun 20, 2025
89961fd
Merge branch 'feat/contribution-service' into feat/repository-service
VishakhaSainani Jun 20, 2025
966d2a2
Fix: Restore correct merge changes for internal/app/repository/domain.go
VishakhaSainani Jun 20, 2025
671c8ac
add contributors url when fetching users contributes repositories
VishakhaSainani Jun 20, 2025
67ab318
seperate logic for fetching repo by github id and repository table id
VishakhaSainani Jun 20, 2025
778c359
use repo id for fetching contributions of a particular repo of a user
VishakhaSainani Jun 23, 2025
cbafcc0
use sqlx methods in user.go
VishakhaSainani Jun 23, 2025
f36069f
use sqlx methods in repository.go
VishakhaSainani Jun 23, 2025
050487e
use sqlx methods in contribution.go
VishakhaSainani Jun 23, 2025
f5af0ac
log error in slog
VishakhaSainani Jun 23, 2025
0bf8a8a
Merge branch 'feat/repository-service' into improvement/use-sqlx-methods
VishakhaSainani Jun 24, 2025
5293cb6
make contribution fetch process from gh-archive dataset on bigquery, …
VishakhaSainani Jun 27, 2025
adb7845
remove fetch users latest contribution handler, made for testing proc…
VishakhaSainani Jun 27, 2025
6c3a6b6
allow null contribution id for redeemed transactions
VishakhaSainani Jun 27, 2025
4a736ce
pass contribution service in dependencies for cron job and remove unn…
VishakhaSainani Jun 27, 2025
bdc0c0a
Merge branch 'db/migration/allow-null-contributionid' into db/migrati…
VishakhaSainani Jun 27, 2025
71d8a4a
add column gh-event-id to use gh-event-id for contributions instead o…
VishakhaSainani Jun 30, 2025
165fec8
seperate and use one alter table per migrations
VishakhaSainani Jun 30, 2025
82fb23a
set column contributors as not null in seperate migration file
VishakhaSainani Jun 30, 2025
7980470
remove unnecessary lines of code
VishakhaSainani Jun 30, 2025
80bab9c
Merge branch 'db/migration/add-contributors-url' into db/migration/ad…
VishakhaSainani Jun 30, 2025
6194eb4
Merge branch 'db/migration/allow-null-contributionid' into db/migrati…
VishakhaSainani Jun 30, 2025
5d8cb59
rename gh_event_id to github_event_id to ensure consistency across names
VishakhaSainani Jun 30, 2025
230cd4e
set not null github-event-id
VishakhaSainani Jun 30, 2025
3ac004e
define contribution fetching query from bigquery as a constant
VishakhaSainani Jul 1, 2025
a306776
rename function FetchUsersAllContributions to FetchUserContributions,…
VishakhaSainani Jul 1, 2025
187dc89
handle no row error in GetContributionScoreDetails function
VishakhaSainani Jul 1, 2025
a73d295
refactor Execute function
VishakhaSainani Jul 1, 2025
85b4680
Merge branch 'feat/repository-service' into feat/github-service
VishakhaSainani Jul 1, 2025
490cc4e
Merge branch 'feat/contribution-cronjob' into feat/github-service
VishakhaSainani Jul 1, 2025
19e50b3
Merge branch 'improvement/use-sqlx-methods' into feat/github-service
VishakhaSainani Jul 1, 2025
1784817
Merge branch 'db/migration/add-contributors-url' into feat/github-ser…
VishakhaSainani Jul 1, 2025
37c4454
Merge branch 'db/migration/add-gh-event-id' into feat/github-service
VishakhaSainani Jul 1, 2025
5397c3e
fix - use actionkey for action string
VishakhaSainani Jul 1, 2025
6cb482d
save github event id for each contribution in db
VishakhaSainani Jul 1, 2025
521be1a
use user github id to fetch contributions from bigquery and refactor …
VishakhaSainani Jul 2, 2025
031ba38
make separate github service for github api calls
VishakhaSainani Jul 2, 2025
1e3e4a4
reduce cognitive complexity of ProcessFetchedContributions Function b…
VishakhaSainani Jul 2, 2025
76df1d2
log error in GetContributionByGithubEventId
VishakhaSainani Jul 3, 2025
f3c25f3
make utility function for GET requests to github API's
VishakhaSainani Jul 3, 2025
ee7aa7f
create a transaction entry for each contribution
VishakhaSainani Jul 3, 2025
244c44d
update user balance with each transaction created
VishakhaSainani Jul 4, 2025
3a82966
refactor code to reduce cognitive complexity of ProcessEachContribution
VishakhaSainani Jul 4, 2025
6551985
fix incorrect merge conflict: missing fetchusecontribution router
VishakhaSainani Jul 4, 2025
6c1f24c
use client from dependencies instead of new client in github handler
VishakhaSainani Jul 4, 2025
d01765b
implement leaderboard feature
VishakhaSainani Jul 7, 2025
91b8c64
implement monthly overview feature
VishakhaSainani Jul 8, 2025
6ee49c9
rename GetUserRanks to ListUserRank and get value from context in han…
VishakhaSainani Jul 14, 2025
ecc55c1
create index for users_current_balance
VishakhaSainani Jul 14, 2025
0d0fe6b
refactor : update namings
VishakhaSainani Jul 14, 2025
cf845de
Merge branch 'feat/leaderboard-service' into feat/monthly-overview
VishakhaSainani Jul 14, 2025
63706a8
refactor ListMonthlyContributionSummary function
VishakhaSainani Jul 14, 2025
466144c
Merge branch 'feat/monthly-overview' into feat/Delete
VishakhaSainani Jul 14, 2025
7fc91d0
refactor soft delete user
VishakhaSainani Jul 14, 2025
29054b1
refactor user deletion feature
VishakhaSainani Jul 15, 2025
402fba4
Merge branch 'main' of https://github.com/joshsoftware/code-curiosity…
VishakhaSainani Jul 16, 2025
7390be2
Merge branch 'main' of https://github.com/joshsoftware/code-curiosity…
VishakhaSainani Jul 16, 2025
8612d28
remove unnecesssary comments
VishakhaSainani Jul 16, 2025
a1b4689
implement goal service
VishakhaSainani Jul 17, 2025
7e434eb
remove unwanted db tags
VishakhaSainani Jul 17, 2025
06a2716
rename query const according to function names
VishakhaSainani Jul 17, 2025
4db322e
implement goal level achieved target
VishakhaSainani Jul 17, 2025
347eb31
implement badge assigning service
VishakhaSainani Jul 18, 2025
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
local.yaml
local.yaml

*.ps1
19 changes: 15 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,47 @@ import (
"log/slog"
"net/http"
"os"

"os/signal"
"syscall"
"time"

"github.com/joshsoftware/code-curiosity-2025/internal/app"
"github.com/joshsoftware/code-curiosity-2025/internal/app/cronJob"
"github.com/joshsoftware/code-curiosity-2025/internal/config"
)

func main() {
ctx := context.Background()

cfg,err := config.LoadAppConfig()
cfg, err := config.LoadAppConfig()
if err != nil {
slog.Error("error loading app config", "error", err)
return
}


db, err := config.InitDataStore(cfg)
if err != nil {
slog.Error("error initializing database", "error", err)
return
}
defer db.Close()

dependencies := app.InitDependencies(db,cfg)
bigqueryInstance, err := config.BigqueryInit(ctx, cfg)
if err != nil {
slog.Error("error initializing bigquery", "error", err)
return
}

httpClient := &http.Client{}

dependencies := app.InitDependencies(db, cfg, bigqueryInstance, httpClient)

router := app.NewRouter(dependencies)

newCronSchedular := cronJob.NewCronSchedular()
newCronSchedular.InitCronJobs(dependencies.ContributionService, dependencies.UserService)

server := http.Server{
Addr: fmt.Sprintf(":%s", cfg.HTTPServer.Port),
Handler: router,
Expand Down
48 changes: 44 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,63 @@ module github.com/joshsoftware/code-curiosity-2025
go 1.23.4

require (
cloud.google.com/go/bigquery v1.68.0
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/golang-migrate/migrate/v4 v4.18.3
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jmoiron/sqlx v1.4.0
github.com/lib/pq v1.10.9
github.com/robfig/cron/v3 v3.0.1
golang.org/x/oauth2 v0.29.0
google.golang.org/api v0.231.0
)

require (
cloud.google.com/go v0.121.0 // indirect
cloud.google.com/go/auth v0.16.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/golang-migrate/migrate/v4 v4.18.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/apache/arrow/go/v15 v15.0.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.14.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.11.0 // indirect
golang.org/x/tools v0.30.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
google.golang.org/grpc v1.72.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
)
Loading