Skip to content

Commit

Permalink
feat: DB Timezone Aisa/Seoul로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
YehyeokBang committed Feb 20, 2024
1 parent 1ec6ad4 commit a7a1a2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion global/config/Setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ConnectDatabase() (*gorm.DB, error) {
MYSQL_PASSWORD := os.Getenv("MYSQL_PASSWORD")
MYSQL_DATABASE := os.Getenv("MYSQL_DATABASE")

dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Asia%%2FSeoul",
MYSQL_USER, MYSQL_PASSWORD, MYSQL_HOST, MYSQL_PORT, MYSQL_DATABASE)

database, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
Expand Down
29 changes: 0 additions & 29 deletions global/router/pb_router.go

This file was deleted.

16 changes: 14 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import (
reportRepository "gdsc/baro/app/report/repositories"
reportService "gdsc/baro/app/report/services"
userController "gdsc/baro/app/user/controllers"
userapp "gdsc/baro/app/user/pb"
userRepository "gdsc/baro/app/user/repositories"
userService "gdsc/baro/app/user/services"
videoController "gdsc/baro/app/video/controllers"
videoapp "gdsc/baro/app/video/pb"
videoRepository "gdsc/baro/app/video/repositories"
videoService "gdsc/baro/app/video/services"

userpb "gdsc/baro/protos/user"
videopb "gdsc/baro/protos/video"

"gdsc/baro/docs"
"gdsc/baro/global"
"gdsc/baro/global/auth"
"gdsc/baro/global/config"
pbrouter "gdsc/baro/global/router"
"gdsc/baro/global/utils"
"log"
"net"
Expand All @@ -24,6 +29,7 @@ import (
"github.com/soheilhy/cmux"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"google.golang.org/grpc"
)

type App struct {
Expand All @@ -46,7 +52,13 @@ func (app *App) InitDocs() {
}

func (app *App) RunGrpcServer(l net.Listener, userRepository userRepository.UserRepositoryInterface, userUtil utils.UserUtilInterface, videoRepository videoRepository.VideoRepositoryInterface) {
grpcServer := pbrouter.NewInitApp(userRepository, userUtil, videoRepository)
grpcServer := grpc.NewServer(grpc.UnaryInterceptor(auth.UnaryAuthInterceptor))

userPbApp := userapp.NewUserPbApp(userRepository, userUtil)
videoPbApp := videoapp.NewVideoPbApp(videoRepository)

userpb.RegisterUserServiceServer(grpcServer, userPbApp)
videopb.RegisterVideoServiceServer(grpcServer, videoPbApp)

if err := grpcServer.Serve(l); err != nil {
log.Fatalf("failed to serve: %v", err)
Expand Down

0 comments on commit a7a1a2e

Please sign in to comment.