diff --git a/.gitea/workflows/tag_release.yaml b/.gitea/workflows/tag_release.yaml deleted file mode 100644 index 802b773..0000000 --- a/.gitea/workflows/tag_release.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: Go Release - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build-and-release: - runs-on: ubuntu-24.04 - steps: - - name: Checkout code - uses: actions/checkout@v5 - - - name: Set up Go - uses: actions/setup-go@v6 - with: - go-version: '1.26.2' - - - name: Create version - id: version - run: | - echo "Creating version" - - VERSION="0.2.4" - PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10) - BRANCH_REF="${{ gitea.ref }}" - BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3) - PROJECT_TAG_RELEASE="v$VERSION-$BRANCH_NAME-$PROJECT_COMMIT_HASH-556" - - echo "::set-output name=project_tag_release::$PROJECT_TAG_RELEASE" - - echo "Version: $VERSION" - echo "Hash: $PROJECT_COMMIT_HASH" - echo "Branh ref: $BRANCH_REF" - echo "Branch: $BRANCH_NAME" - echo "Tag Release: $PROJECT_TAG_RELEASE" - - - name: Print version - id: Version - run: | - echo "Printing version" - echo "Version: ${{ steps.version.outputs.project_tag_release }}" - - - name: Create GitHub Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.version.outputs.project_tag_release }} - release_name: Release ${{ steps.version.outputs.project_tag_release }} - body: | - Release of version ${{ steps.version.outputs.project_tag_release }} diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml deleted file mode 100644 index 19c6482..0000000 --- a/.gitea/workflows/workflow.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Go CI - -on: [push, pull_request] # Triggers on push or pull request events - -jobs: - test: - name: Test and Lint - runs-on: ubuntu-24.04 - steps: - - name: Check out repository code - uses: actions/checkout@v5 - - - name: Set up Go - uses: actions/setup-go@v6 - with: - go-version: '1.26.2' - - name: Configure Git for SSH - run: | - git config --global url."git@${{ secrets.GIT_HOST_ROOT }}:".insteadOf "https://${{ secrets.GIT_HOST_ROOT }}/" - go env -w GOPRIVATE=${{ secrets.GIT_HOST_ROOT }}/phoenix/* - - - name: Download dependencies - run: | - go mod download - - - name: Run tests - run: go test -v ./... # Runs all tests in the project diff --git a/README.md b/README.md deleted file mode 100644 index 622a843..0000000 --- a/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# textsender-models -A library containing functions, structs, types, and other code for the textsender -project - - -### Building project -```SHELL -go mod tidy -go mod vendor -``` diff --git a/go.mod b/go.mod deleted file mode 100644 index 36f7a6e..0000000 --- a/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module git.kundeng.us/phoenix/textsender-models - -go 1.26.2 - -require ( - github.com/golang-jwt/jwt/v5 v5.3.1 - github.com/google/uuid v1.6.0 - github.com/stretchr/testify v1.11.1 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 346e255..0000000 --- a/go.sum +++ /dev/null @@ -1,14 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= -github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tx0/config/auxiliary/twilio_config.go b/tx0/config/auxiliary/twilio_config.go deleted file mode 100644 index f03332c..0000000 --- a/tx0/config/auxiliary/twilio_config.go +++ /dev/null @@ -1,20 +0,0 @@ -package auxiliary - -import ( - "fmt" -) - -type TwilioConfig struct { - AccountSID string `json:"auth_sid"` - ServiceSID string `json:"service_sid"` - AuthToken string `json:"auth_token"` - Number string `json:"phone_number"` -} - -func (config *TwilioConfig) PrintConfig() { - fmt.Println("Twilio config") - fmt.Println("Account SID:", config.AccountSID) - fmt.Println("Service SID:", config.ServiceSID) - fmt.Println("Auth Token:", config.AuthToken) - fmt.Println("Number:", config.Number) -} diff --git a/tx0/contact/contact.go b/tx0/contact/contact.go deleted file mode 100644 index 6baee60..0000000 --- a/tx0/contact/contact.go +++ /dev/null @@ -1,14 +0,0 @@ -package contact - -import ( - "github.com/google/uuid" -) - -type Contact struct { - Id *uuid.UUID `json:"id,omitempty"` - Firstname *string `json:"first_name,omitempty"` - Lastname *string `json:"last_name,omitempty"` - Nickname *string `json:"nickname,omitempty"` - PhoneNumber string `json:"phone_number"` - UserId *uuid.UUID `json:"user_id,omitempty"` -} diff --git a/tx0/message/event/response.go b/tx0/message/event/response.go deleted file mode 100644 index 720dd6b..0000000 --- a/tx0/message/event/response.go +++ /dev/null @@ -1,18 +0,0 @@ -package event - -import ( - "time" - - "github.com/google/uuid" -) - -type MessageEventResponse struct { - Id uuid.UUID `json:"id,omitempty"` - ScheduledMessageEventId uuid.UUID `json:"scheduled_message_event_id,omitempty"` - Response map[string]any `json:"response"` - UserId uuid.UUID `json:"user_id,omitempty"` - ContactId *uuid.UUID `json:"contact_id,omitempty"` - MessageId *uuid.UUID `json:"message_id,omitempty"` - Status string `json:"status"` - Sent time.Time `json:"sent"` -} diff --git a/tx0/message/event/status.go b/tx0/message/event/status.go deleted file mode 100644 index f979152..0000000 --- a/tx0/message/event/status.go +++ /dev/null @@ -1,6 +0,0 @@ -package event - -const ( - Message_Event_Response_Status_Instant = "INSTANT" - Message_Event_Response_Status_Scheduled = "SCHEDULED" -) diff --git a/tx0/message/message.go b/tx0/message/message.go deleted file mode 100644 index 71fe125..0000000 --- a/tx0/message/message.go +++ /dev/null @@ -1,11 +0,0 @@ -package message - -import ( - "github.com/google/uuid" -) - -type Message struct { - Id *uuid.UUID `json:"id,omitempty"` - Content string `json:"content"` - UserId *uuid.UUID `json:"user_id,omitempty"` -} diff --git a/tx0/message/scheduling/event.go b/tx0/message/scheduling/event.go deleted file mode 100644 index e8d7fa5..0000000 --- a/tx0/message/scheduling/event.go +++ /dev/null @@ -1,15 +0,0 @@ -package scheduling - -import ( - "time" - - "github.com/google/uuid" -) - -type ScheduledMessageEvent struct { - Id uuid.UUID `json:"id"` - ContactId uuid.UUID `json:"contact_id"` - MessageId uuid.UUID `json:"message_id"` - ScheduledMessageId uuid.UUID `json:"scheduled_message_id"` - Created time.Time `json:"created"` -} diff --git a/tx0/message/scheduling/message.go b/tx0/message/scheduling/message.go deleted file mode 100644 index dcdec5b..0000000 --- a/tx0/message/scheduling/message.go +++ /dev/null @@ -1,15 +0,0 @@ -package scheduling - -import ( - "time" - - "github.com/google/uuid" -) - -type ScheduledMessage struct { - Id uuid.UUID `json:"id"` - Scheduled time.Time `json:"scheduled"` - Created time.Time `json:"created"` - Status string `json:"status"` - UserId uuid.UUID `json:"user_id"` -} diff --git a/tx0/message/scheduling/status.go b/tx0/message/scheduling/status.go deleted file mode 100644 index 9198cbd..0000000 --- a/tx0/message/scheduling/status.go +++ /dev/null @@ -1,8 +0,0 @@ -package scheduling - -const ( - Ready = "READY" - Pending = "PENDING" - Processing = "PROCESSING" - Done = "DONE" -) diff --git a/tx0/token/token.go b/tx0/token/token.go deleted file mode 100644 index b6fb11e..0000000 --- a/tx0/token/token.go +++ /dev/null @@ -1,24 +0,0 @@ -package token - -import ( - "github.com/golang-jwt/jwt/v5" - "github.com/google/uuid" -) - -type Claims struct { - UserId uuid.UUID `json:"user_id"` - Role string `json:"role"` - jwt.RegisteredClaims -} - -type LoginResult struct { - UserId uuid.UUID `json:"user_id"` - AccessToken string `json:"access_token"` - TokenType string `json:"token_type"` - ExpiresIn int64 `json:"expires_in"` - IssuedAt int64 `json:"issued_at"` -} - -// Alias for LoginResult -// Will be deprecated at some point -type Login = LoginResult diff --git a/tx0/types/jsonb.go b/tx0/types/jsonb.go deleted file mode 100644 index d8dffbf..0000000 --- a/tx0/types/jsonb.go +++ /dev/null @@ -1,42 +0,0 @@ -package types - -import ( - "database/sql/driver" - "encoding/json" - "fmt" -) - -// NOTE: Might end up removing this -type JSONB json.RawMessage - -// Scan implements sql.Scanner -func (j *JSONB) Scan(value interface{}) error { - if value == nil { - *j = nil - return nil - } - - var data []byte - switch v := value.(type) { - case []byte: - // pgx may pass data as []byte in binary format - data = v - case string: - // pgx may pass data as string in text format - data = []byte(v) - default: - return fmt.Errorf("unsupported type: %T", v) - } - - *j = JSONB(data) - return nil -} - -// Value implements driver.Valuer -func (j JSONB) Value() (driver.Value, error) { - if j == nil { - return nil, nil - } else { - return []byte(j), nil - } -} diff --git a/tx0/user/login_history.go b/tx0/user/login_history.go deleted file mode 100644 index 7f39e33..0000000 --- a/tx0/user/login_history.go +++ /dev/null @@ -1,18 +0,0 @@ -package user - -import ( - "github.com/google/uuid" - "time" -) - -type UserLoginHistory struct { - Id uuid.UUID `json:"id"` - LoginTime time.Time `json:"login_time"` - UserId uuid.UUID `json:"user_id"` -} - -type ServiceUserLoginHistory struct { - Id uuid.UUID `json:"id"` - LoginTime time.Time `json:"login_time"` - ServiceUserId uuid.UUID `json:"service_user_id"` -} diff --git a/tx0/user/organization.go b/tx0/user/organization.go deleted file mode 100644 index 2314d51..0000000 --- a/tx0/user/organization.go +++ /dev/null @@ -1,13 +0,0 @@ -package user - -import ( - "time" - - "github.com/google/uuid" -) - -type Organization struct { - Id uuid.UUID `json:"id"` - Name string `json:"name"` - Created *time.Time `json:"created,omitempty"` -} diff --git a/tx0/user/service_user.go b/tx0/user/service_user.go deleted file mode 100644 index c613a7c..0000000 --- a/tx0/user/service_user.go +++ /dev/null @@ -1,16 +0,0 @@ -package user - -import ( - "time" - - "github.com/google/uuid" -) - -type ServiceUser struct { - Id uuid.UUID `json:"id"` - // TODO: Remove the omitempty tags at a later point - Username string `json:"username,omitempty"` - Passphrase string `json:"passphrase,omitempty"` - Created time.Time `json:"created"` - LastLogin *time.Time `json:"last_login,omitempty"` -} diff --git a/tx0/user/user.go b/tx0/user/user.go deleted file mode 100644 index 3bbf161..0000000 --- a/tx0/user/user.go +++ /dev/null @@ -1,20 +0,0 @@ -package user - -import ( - "time" - - "github.com/google/uuid" -) - -type User struct { - Id uuid.UUID `json:"id"` - PhoneNumber string `json:"phone_number"` - Username string `json:"username"` - Password string `json:"password"` - // Firstname is a pointer - Firstname *string `json:"first_name,omitempty"` - // Lastname is a pointer - Lastname *string `json:"last_name,omitempty"` - Created time.Time `json:"created"` - LastLogin *time.Time `json:"last_login,omitempty"` -} diff --git a/tx0/user/user_profile.go b/tx0/user/user_profile.go deleted file mode 100644 index 37b7f4a..0000000 --- a/tx0/user/user_profile.go +++ /dev/null @@ -1,41 +0,0 @@ -package user - -import ( - "fmt" - "time" - - "github.com/google/uuid" -) - -type UserProfile struct { - UserId uuid.UUID `json:"user_id"` - PhoneNumber string `json:"phone_number"` - Username string `json:"username"` - Firstname *string `json:"firstname,omitempty"` - Lastname *string `json:"lastname,omitempty"` - Created time.Time `json:"created"` - LastLogin *time.Time `json:"last_login,omitempty"` -} - -func InitUserProfile(usr *User) (usrProfile *UserProfile, err error) { - if usr == nil { - return nil, fmt.Errorf("User is empty") - } else { - usrProfile = new(UserProfile) - usrProfile.UserId = usr.Id - usrProfile.PhoneNumber = usr.PhoneNumber - usrProfile.Username = usr.Username - if usr.Firstname != nil { - usrProfile.Firstname = usr.Firstname - } - if usr.Lastname != nil { - usrProfile.Lastname = usr.Lastname - } - usrProfile.Created = usr.Created - if usr.LastLogin != nil { - usrProfile.LastLogin = usr.LastLogin - } - - return usrProfile, nil - } -} diff --git a/tx0/user/user_profile_test.go b/tx0/user/user_profile_test.go deleted file mode 100644 index 31e7bbd..0000000 --- a/tx0/user/user_profile_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package user - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestInitUserProfile(t *testing.T) { - usr := User{Username: "Bob", PhoneNumber: "+12224572351", Password: "TheNight!"} - - profile, err := InitUserProfile(&usr) - - assert.NoError(t, err, "Error %v", err) - assert.NotEmpty(t, profile, "UserProfile is empty") -}