Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ air:
air

db-upgrade:
goose up
go run ./cmd/$(project_name)/main.go db:migrate

db-upgrade-raw:
go run ./cmd/$(project_name)/main.go db:migrate
go run ./cmd/$(project_name)/main.go db:auto-migrate

run:
go run cmd/$(project_name)/main.go
Expand Down
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
"message": {
"description": "Текст сообщения",
"type": "string",
"maxLength": 256,
"maxLength": 65535,
"example": "Hello World!"
},
"phoneNumbers": {
Expand Down
2 changes: 1 addition & 1 deletion api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ definitions:
message:
description: Текст сообщения
example: Hello World!
maxLength: 256
maxLength: 65535
type: string
phoneNumbers:
description: Получатели
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE `messages`
MODIFY COLUMN `message` text NOT NULL;
-- +goose StatementEnd
---
-- +goose Down
-- +goose StatementBegin
ALTER TABLE `messages`
MODIFY COLUMN `message` tinytext NOT NULL;
-- +goose StatementEnd
2 changes: 1 addition & 1 deletion internal/sms-gateway/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Message struct {
ID uint64 `gorm:"primaryKey;type:BIGINT UNSIGNED;autoIncrement"`
DeviceID string `gorm:"not null;type:char(21);uniqueIndex:unq_messages_id_device,priority:2;index:idx_messages_device_state"`
ExtID string `gorm:"not null;type:varchar(36);uniqueIndex:unq_messages_id_device,priority:1"`
Message string `gorm:"not null;type:tinytext"`
Message string `gorm:"not null;type:text"`
State MessageState `gorm:"not null;type:enum('Pending','Sent','Processed','Delivered','Failed');default:Pending;index:idx_messages_device_state"`
ValidUntil *time.Time `gorm:"type:datetime"`
SimNumber *uint8 `gorm:"type:tinyint(1) unsigned"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/smsgateway/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
// Сообщение
type Message struct {
ID string `json:"id,omitempty" validate:"omitempty,max=36" example:"PyDmBQZZXYmyxMwED8Fzy"` // Идентификатор
Message string `json:"message" validate:"required,max=256" example:"Hello World!"` // Текст сообщения
Message string `json:"message" validate:"required,max=65535" example:"Hello World!"` // Текст сообщения
TTL *uint64 `json:"ttl,omitempty" validate:"omitempty,min=5" example:"86400"` // Время жизни сообщения в секундах
SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitempty,max=3" example:"1"` // Номер сим-карты
WithDeliveryReport *bool `json:"withDeliveryReport,omitempty" example:"true"` // Запрашивать отчет о доставке
Expand Down