diff --git a/.gitea/workflows/tag_release.yaml b/.gitea/workflows/tag_release.yaml index b63e689..995ee4e 100644 --- a/.gitea/workflows/tag_release.yaml +++ b/.gitea/workflows/tag_release.yaml @@ -25,7 +25,7 @@ jobs: run: | echo "Creating version" - VERSION="0.0.14" + VERSION="0.1.6" PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10) BRANCH_REF="${{ gitea.ref }}" BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3) diff --git a/tx0/config/twilio_config.go b/tx0/config/auxiliary/twilio_config.go similarity index 96% rename from tx0/config/twilio_config.go rename to tx0/config/auxiliary/twilio_config.go index a597546..f03332c 100644 --- a/tx0/config/twilio_config.go +++ b/tx0/config/auxiliary/twilio_config.go @@ -1,4 +1,4 @@ -package config +package auxiliary import ( "fmt" diff --git a/tx0/message/event/response.go b/tx0/message/event/response.go new file mode 100644 index 0000000..720dd6b --- /dev/null +++ b/tx0/message/event/response.go @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..f979152 --- /dev/null +++ b/tx0/message/event/status.go @@ -0,0 +1,6 @@ +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 index e4f5276..71fe125 100644 --- a/tx0/message/message.go +++ b/tx0/message/message.go @@ -5,7 +5,7 @@ import ( ) type Message struct { - Id uuid.UUID `json:"id"` - Content string `json:"content,omitempty"` - UserId uuid.UUID `json:"user_id"` + Id *uuid.UUID `json:"id,omitempty"` + Content string `json:"content"` + UserId *uuid.UUID `json:"user_id,omitempty"` } diff --git a/tx0/message/message_event_response.go b/tx0/message/message_event_response.go deleted file mode 100644 index f47d461..0000000 --- a/tx0/message/message_event_response.go +++ /dev/null @@ -1,25 +0,0 @@ -package message - -import ( - "time" - - "github.com/google/uuid" - - "git.kundeng.us/phoenix/textsender-models/tx0/types" -) - -type MessageEventResponse struct { - Id uuid.UUID `json:"id,omitempty"` - ScheduledMessageEventId uuid.UUID `json:"scheduled_message_event_id,omitempty"` - Response types.JSONB `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"` -} - -const ( - Message_Event_Response_Status_Instant = "INSTANT" - Message_Event_Response_Status_Scheduled = "SCHEDULED" -) diff --git a/tx0/message/scheduling/event.go b/tx0/message/scheduling/event.go index 3a3f1aa..e8d7fa5 100644 --- a/tx0/message/scheduling/event.go +++ b/tx0/message/scheduling/event.go @@ -8,7 +8,7 @@ import ( type ScheduledMessageEvent struct { Id uuid.UUID `json:"id"` - RecipientId uuid.UUID `json:"recipient_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/types/jsonb.go b/tx0/types/jsonb.go index 9bacec6..d8dffbf 100644 --- a/tx0/types/jsonb.go +++ b/tx0/types/jsonb.go @@ -6,6 +6,7 @@ import ( "fmt" ) +// NOTE: Might end up removing this type JSONB json.RawMessage // Scan implements sql.Scanner diff --git a/tx0/user/service_user.go b/tx0/user/service_user.go index 22762d5..c613a7c 100644 --- a/tx0/user/service_user.go +++ b/tx0/user/service_user.go @@ -7,8 +7,10 @@ import ( ) type ServiceUser struct { - Id uuid.UUID `json:"id"` - Username string `json:"username,omitempty"` - Passphrase string `json:"passphrase,omitempty"` - Created time.Time `json:"date_created"` + 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 index ab6f8af..4e967d5 100644 --- a/tx0/user/user.go +++ b/tx0/user/user.go @@ -13,6 +13,6 @@ type User struct { Password string `json:"password"` Firstname *string `json:"first_name,omitempty"` Lastname *string `json:"last_name,omitempty"` - Created time.Time `json:"date_created"` + Created time.Time `json:"created"` LastLogin *time.Time `json:"last_login,omitempty"` }