Skip to content

Commit

Permalink
refactor(common-job): mv cron -> common-job (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
sugar-cat7 authored Sep 24, 2024
1 parent 9d648a0 commit 2103dc0
Show file tree
Hide file tree
Showing 133 changed files with 412 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ updates:
# update-types: ["version-update:semver-major"]

- package-ecosystem: "gomod"
directory: "/service/cron/"
directory: "/service/common-job/"
schedule:
interval: "weekly"
ignore:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'service/cron/**'
- 'service/common-job/**'

permissions:
contents: read
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./service/cron
working-directory: ./service/common-job

steps:
- uses: actions/checkout@v4
Expand All @@ -39,4 +39,4 @@ jobs:
uses: golangci/golangci-lint-action@v5
with:
version: v1.58.0
working-directory: ./service/cron
working-directory: ./service/common-job
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: sqlc

sqlc:
@echo "Pulling sqlc/sqlc Docker image..."
docker pull sqlc/sqlc
@echo "Removing old generated files..."
rm -rf ./service/common-job/infra/database/internal/gen
@echo "Generating sqlc files..."
docker run --rm -v $$(pwd):/src -w /src sqlc/sqlc generate
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Vspo Portal is a repository for providing fan-made services related to Vspo. ([X
| Service Name | Description | Repository |
| ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| [Spodule](https://www.vspo-schedule.com/schedule/all) | A site where you can check the broadcasts (YouTube/Twitch/Twitcasting/Niconico) and clips of Vspo members. | [vspo-schedule](./service/vspo-schedule/) |
| Common API | | [vspo-schedule-api](./service/cron/) |
| Common API | | [vspo-schedule-api](./service/common-job/) |


## Development Roadmap
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion service/cron/README.md → service/common-job/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Vspo Cron
## Vspo Job Service

### Description
Youtube/Twitch/Twitcasting live stream update cron service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package handler
import (
"net/http"

http_func "github.com/sugar-cat7/vspo-portal/service/cron/infra/http/cron"
http_func "github.com/sugar-cat7/vspo-portal/service/common-job/infra/http/cron"
)

func Handler(w http.ResponseWriter, r *http.Request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package handler
import (
"net/http"

http_func "github.com/sugar-cat7/vspo-portal/service/cron/infra/http/cron"
http_func "github.com/sugar-cat7/vspo-portal/service/common-job/infra/http/cron"
)

func Handler(w http.ResponseWriter, r *http.Request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package handler
import (
"net/http"

http_func "github.com/sugar-cat7/vspo-portal/service/cron/infra/http/cron"
http_func "github.com/sugar-cat7/vspo-portal/service/common-job/infra/http/cron"
)

func Handler(w http.ResponseWriter, r *http.Request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

utime "github.com/sugar-cat7/vspo-portal/service/cron/pkg/time"
utime "github.com/sugar-cat7/vspo-portal/service/common-job/pkg/time"
)

type Period string
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package repository
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package repository
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_repository
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package repository
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_repository
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package twitcasting
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_twitcasting
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package twitch
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_twitch
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package youtube
import (
"context"

"github.com/sugar-cat7/vspo-portal/service/cron/domain/model"
"github.com/sugar-cat7/vspo-portal/service/common-job/domain/model"
)

//go:generate go run go.uber.org/mock/mockgen -source=$GOFILE -destination=mock/$GOFILE -package=mock_youtube
Expand Down
2 changes: 1 addition & 1 deletion service/cron/go.mod → service/common-job/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/sugar-cat7/vspo-portal/service/cron
module github.com/sugar-cat7/vspo-portal/service/common-job

go 1.22

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package cron_cmd

import (
"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/cron_cmd/channel_cmd"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/cron_cmd/video_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/cron_cmd/channel_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/cron_cmd/video_cmd"
)

// NewCronCmd is a function to create cron command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package video_cmd

import (
"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/cron_cmd/video_cmd/clip_cmd"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/cron_cmd/video_cmd/livestream_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/cron_cmd/video_cmd/clip_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/cron_cmd/video_cmd/livestream_cmd"
)

// NewVideoCmd is a function to create video command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/caarlos0/env/v10"
"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/dependency"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/environment"
"github.com/sugar-cat7/vspo-portal/service/cron/pkg/logger"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/dependency"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/environment"
"github.com/sugar-cat7/vspo-portal/service/common-job/pkg/logger"
)

// NewVideoCmd is a function to create video command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"

"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/usecase"
"github.com/sugar-cat7/vspo-portal/service/cron/usecase/input"
"github.com/sugar-cat7/vspo-portal/service/common-job/usecase"
"github.com/sugar-cat7/vspo-portal/service/common-job/usecase/input"
)

type CMD struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package db_migration_cmd
import (
"github.com/caarlos0/env/v10"
"github.com/spf13/cobra"
migration "github.com/sugar-cat7/vspo-portal/service/cron/infra/database/schema"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/environment"
migration "github.com/sugar-cat7/vspo-portal/service/common-job/infra/database/schema"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/environment"
)

func NewDBMigrationCmd() *cobra.Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package http_cmd
import (
"github.com/caarlos0/env/v10"
"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/environment"
http_serve "github.com/sugar-cat7/vspo-portal/service/cron/infra/http/cron"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/environment"
http_serve "github.com/sugar-cat7/vspo-portal/service/common-job/infra/http/cron"
)

func NewHttpServeCmd() *cobra.Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package cmd

import (
"github.com/spf13/cobra"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/cron_cmd"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/db_migration_cmd"
"github.com/sugar-cat7/vspo-portal/service/cron/infra/cmd/internal/http_cmd"
"github.com/sugar-cat7/vspo-portal/service/cron/pkg/logger"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/cron_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/db_migration_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/infra/cmd/internal/http_cmd"
"github.com/sugar-cat7/vspo-portal/service/common-job/pkg/logger"
)

// NewCmdRoot is a function to create root command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"

"github.com/jackc/pgx/v5/pgxpool"
db_sqlc "github.com/sugar-cat7/vspo-portal/service/cron/infra/database/internal/gen"
db_sqlc "github.com/sugar-cat7/vspo-portal/service/common-job/infra/database/internal/gen"
)

// ClientKey is the key for the database connection used within the context.
Expand Down
Loading

0 comments on commit 2103dc0

Please sign in to comment.