This commit is contained in:
Sergey Melnikov 2024-01-29 08:09:30 +03:00
parent 9856d04a20
commit 346e5b27b5
13 changed files with 29 additions and 29 deletions

View File

@ -3,7 +3,7 @@ services:
cassandra:
container_name: cassandra
environment:
- CASSANDRA_KEYSPACE=userprofileservice
- CASSANDRA_KEYSPACE=userservice
- TABLE_NAME=users
build:
context: .
@ -16,7 +16,7 @@ services:
environment:
- CASSANDRA_HOST=cassandra
- CASSANDRA_PORT=9042
- CASSANDRA_KEYSPACE=userprofileservice
- CASSANDRA_KEYSPACE=userservice
- CASSANDRA_CONSISTANCY=LOCAL_QUORUM
- TABLE_NAME=users
- BIDN_SERVICE=:8080
@ -25,7 +25,7 @@ services:
- AWS_SECRET_ACCESS_KEY=fake-secret
- BUCKET_NAME=fake-bucket
- AWS_ACL=public-read
build:
build:
context: .
dockerfile: ./docker/api/Dockerfile
ports:

2
go.mod
View File

@ -1,4 +1,4 @@
module userprofileservice
module userservice
go 1.21.6

View File

@ -2,7 +2,7 @@ package aws
import (
"io"
"userprofileservice/src/utils"
"userservice/src/utils"
"github.com/aws/aws-sdk-go/aws/session"
)

View File

@ -1,8 +1,8 @@
package controller
import (
"userprofileservice/src/model"
"userprofileservice/src/structs"
"userservice/src/model"
"userservice/src/structs"
"github.com/gocql/gocql"
)

View File

@ -6,7 +6,7 @@ package mock_controller
import (
reflect "reflect"
structs "userprofileservice/src/structs"
structs "userservice/src/structs"
gocql "github.com/gocql/gocql"
gomock "github.com/golang/mock/gomock"

View File

@ -1,8 +1,8 @@
package controller
import (
"userprofileservice/src/model"
"userprofileservice/src/structs"
"userservice/src/model"
"userservice/src/structs"
"github.com/gocql/gocql"
)

View File

@ -3,10 +3,10 @@ package main
import (
"log"
"net/http"
"userprofileservice/src/controller"
"userprofileservice/src/model"
"userprofileservice/src/utils"
"userprofileservice/src/view"
"userservice/src/controller"
"userservice/src/model"
"userservice/src/utils"
"userservice/src/view"
)
func main() {

View File

@ -3,9 +3,9 @@ package main
import (
"log"
"testing"
"userprofileservice/src/controller"
mock_controller "userprofileservice/src/controller/mocks"
"userprofileservice/src/structs"
"userservice/src/controller"
mock_controller "userservice/src/controller/mocks"
"userservice/src/structs"
"github.com/gocql/gocql"
"github.com/golang/mock/gomock"

View File

@ -3,7 +3,7 @@ package model
import (
"log"
"time"
"userprofileservice/src/utils"
"userservice/src/utils"
"github.com/gocql/gocql"
)
@ -11,7 +11,7 @@ import (
func NewCassandra() *gocql.Session {
conf := gocql.NewCluster(utils.GetEnv("CASSANDRA_HOST", "cassandra"))
conf.Port = utils.ParsePort(utils.GetEnv("CASSANDRA_PORT", "9042"))
conf.Keyspace = utils.GetEnv("CASSANDRA_KEYSPACE", "userprofileservice")
conf.Keyspace = utils.GetEnv("CASSANDRA_KEYSPACE", "userservice")
conf.Consistency = gocql.ParseConsistency(utils.GetEnv("CASSANDRA_CONSISTANCY", "LOCAL_QUORUM"))
sess, err := conf.CreateSession()
if err != nil {

View File

@ -1,7 +1,7 @@
package model
import (
"userprofileservice/src/structs"
"userservice/src/structs"
"github.com/gocql/gocql"
)

View File

@ -1,8 +1,8 @@
package model
import (
"userprofileservice/src/structs"
"userprofileservice/src/utils"
"userservice/src/structs"
"userservice/src/utils"
"github.com/gocql/gocql"
)
@ -71,7 +71,7 @@ func (c *ModelCassandra) CreateUser(user *structs.USER) error {
// GetUser return user data by id
func (c *ModelCassandra) GetUser(id gocql.UUID) (*structs.USER, error) {
q := `SELECT id, firstname, lastname, currentlocation, birthday, userpicture, certificate
q := `SELECT id, firstname, lastname, currentlocation, birthday, userpicture, certificate
FROM ` + c.TableName + ` WHERE id = ? LIMIT 1`
user := &structs.USER{}

View File

@ -5,7 +5,7 @@ import (
"reflect"
"strconv"
"strings"
"userprofileservice/src/structs"
"userservice/src/structs"
)
// GetEnv look up ENV settings

View File

@ -4,12 +4,12 @@ import (
"encoding/json"
"errors"
"net/http"
"userprofileservice/src/aws"
"userprofileservice/src/controller"
"userprofileservice/src/structs"
"userprofileservice/src/utils"
"userservice/src/aws"
"userservice/src/controller"
"userservice/src/structs"
"userservice/src/utils"
_ "userprofileservice/src/docs"
_ "userservice/src/docs"
"github.com/gocql/gocql"
"github.com/gorilla/mux"