WIP: EOL
This commit is contained in:
parent
7ed1e05284
commit
49e05cac10
23 changed files with 613 additions and 253 deletions
20
cmd/migrate.go
Normal file
20
cmd/migrate.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var migrateCmd = &cobra.Command{
|
||||
Use: "migrate",
|
||||
Short: "Migrate database schema up/down",
|
||||
Long: `All software has versions. This is backoffice backend's`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Migrate database schema up/down")
|
||||
},
|
||||
}
|
||||
26
cmd/migrate_up.go
Normal file
26
cmd/migrate_up.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
migrateCmd.AddCommand(migrateUpCmd)
|
||||
}
|
||||
|
||||
var migrateUpCmd = &cobra.Command{
|
||||
Use: "up",
|
||||
Short: "Migrate database schema up",
|
||||
Long: ``,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// TODO: Implement this
|
||||
|
||||
// TODO: get database URL
|
||||
|
||||
// TODO: run migrations
|
||||
|
||||
// TODO: handle errors
|
||||
|
||||
// TODO: gracefully shutdown
|
||||
},
|
||||
}
|
||||
20
cmd/server.go
Normal file
20
cmd/server.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"gitlab.mareshq.com/hq/backoffice/backoffice-api/internal/server"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(serverCmd)
|
||||
}
|
||||
|
||||
var serverCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Starts backoffice backend API server",
|
||||
Long: ``,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
srv := server.NewServer()
|
||||
srv.Run()
|
||||
},
|
||||
}
|
||||
21
cmd/version.go
Normal file
21
cmd/version.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"gitlab.mareshq.com/hq/backoffice/backoffice-api/internal/version"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version number of backoffice backend",
|
||||
Long: `All software has versions. This is backoffice backend's`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("Version: %s (commit: %s)\n", version.Version, version.Commit)
|
||||
},
|
||||
}
|
||||
Reference in a new issue