Skip to content

Commit

Permalink
fix: room api field
Browse files Browse the repository at this point in the history
  • Loading branch information
minkj1992 committed Jun 25, 2022
1 parent 8857025 commit 22b1567
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 10 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
credentials.json
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/**/out/
/**/*.iml
/**/*.ipr

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### Gradle template
.gradle
/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!/gradle/wrapper/gradle-wrapper.jar
!/java/gradle/wrapper/gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Java template
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### macOS template
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

/**/generated/
/logs/
/application.pid
/application.port

# Ignore `bin` dir
*/bin/*


.vscode/

credentials.json
firebase-credential.json
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# pitch backend
> GDG summer hackerton 2022

## local
```
# local
$ make run
```

- http://localhost:8080/swagger/index.html

## prod

- cloud run ci/cd
- https://cloud.google.com/run/docs/quickstarts/deploy-continuously?hl=en_US#cloudrun_deploy_continuous_code-go
- https://cloud.google.com/build/docs/automating-builds/build-repos-from-github
- [cloud run](https://cloud.google.com/run/docs/quickstarts/deploy-continuously?hl=en_US)
- [cloud sql](https://cloud.google.com/sql/docs/mysql/connect-run)
- https://cloud.google.com/sql/docs/mysql/connect-instance-cloud-run
```
- http://localhost:8080/swagger/index.html
```
4 changes: 3 additions & 1 deletion application/controller/roomController.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type responseRoom struct {
Name string `json:"name"`
CreatedAt *time.Time `json:"createdAt"`
TaskProgress int `json:"taskProgress"`
Goal string `json:"goal"`
StartEnd string `json:"startEnd"`
}

Expand All @@ -50,7 +51,7 @@ const (
allDone = 100
)

// TODO: move to domain but fxxking hackaton
// TODO: move to domain but notime hackaton
func getTasksProgress(tasks entity.Tasks) int {
total := len(tasks)
count := 0
Expand Down Expand Up @@ -97,6 +98,7 @@ func (rc *roomController) GetAll() gin.HandlerFunc {
ID: room.ID,
Name: room.Name,
CreatedAt: room.CreatedAt,
Goal: room.Goal,
TaskProgress: getTasksProgress(*tasks),
StartEnd: room.GetStartEnd(),
})
Expand Down
21 changes: 16 additions & 5 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ const docTemplate = `{
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"contact": {
"name": "API Support",
"url": "https://minkj1992.github.io",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
Expand Down Expand Up @@ -389,6 +397,9 @@ const docTemplate = `{
"createdAt": {
"type": "string"
},
"goal": {
"type": "string"
},
"id": {
"type": "integer"
},
Expand Down Expand Up @@ -435,12 +446,12 @@ const docTemplate = `{

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Version: "1.0",
Host: "",
BasePath: "",
BasePath: "/v1",
Schemes: []string{},
Title: "",
Description: "",
Title: "Pitch API Server (dobby's)",
Description: "This is a pitch api server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
Expand Down
17 changes: 16 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"swagger": "2.0",
"info": {
"contact": {}
"description": "This is a pitch api server.",
"title": "Pitch API Server (dobby's)",
"contact": {
"name": "API Support",
"url": "https://minkj1992.github.io",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"basePath": "/v1",
"paths": {
"/rooms": {
"get": {
Expand Down Expand Up @@ -377,6 +389,9 @@
"createdAt": {
"type": "string"
},
"goal": {
"type": "string"
},
"id": {
"type": "integer"
},
Expand Down
14 changes: 13 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
basePath: /v1
definitions:
controller.ResponseTask:
properties:
Expand Down Expand Up @@ -87,6 +88,8 @@ definitions:
properties:
createdAt:
type: string
goal:
type: string
id:
type: integer
name:
Expand Down Expand Up @@ -115,7 +118,16 @@ definitions:
type: string
type: object
info:
contact: {}
contact:
email: [email protected]
name: API Support
url: https://minkj1992.github.io
description: This is a pitch api server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Pitch API Server (dobby's)
version: "1.0"
paths:
/rooms:
get:
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/configs/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package configs

import (
"fmt"

"github.com/piTch-time/pitch-backend/infrastructure/logger"
"github.com/spf13/viper"
"go.uber.org/zap"
Expand All @@ -13,6 +15,7 @@ const (

// Config ...
type Config struct {
Host string `mapstructure:"host"`
DBConfig DBConfig `mapstructure:"db-config"`
}

Expand Down Expand Up @@ -41,6 +44,8 @@ func Load(path string) (Config, error) {
}

err = viper.Unmarshal(&config)

fmt.Println(config)
return config, err
}

Expand Down
1 change: 1 addition & 0 deletions infrastructure/configs/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
host: "localhost:8080"
db-config:
host: "0.0.0.0"
port: 3306
Expand Down

0 comments on commit 22b1567

Please sign in to comment.