Skip to content
Open
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
1 change: 1 addition & 0 deletions api/mobile.http
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Authorization: Bearer {{mobileToken}}
Content-Type: application/json

{
"id": "LGWvvI23l1DerKrwdr35t",
"name": "Android Phone"
}

Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
firebase.google.com/go/v4 v4.19.0
github.com/android-sms-gateway/client-go v1.12.9-0.20260519005959-eae21b02f80f
github.com/android-sms-gateway/client-go v1.12.10-0.20260524050942-22cc236032cd
github.com/ansrivas/fiberprometheus/v2 v2.6.1
github.com/capcom6/go-helpers v0.3.0
github.com/capcom6/go-infra-fx v0.5.2
Expand All @@ -14,7 +14,7 @@ require (
github.com/go-core-fx/logger v0.0.0-20251028014216-c34d2fb15ca2
github.com/go-playground/assert/v2 v2.2.0
github.com/go-playground/validator/v10 v10.28.0
github.com/go-sql-driver/mysql v1.7.1
github.com/go-sql-driver/mysql v1.8.1
github.com/gofiber/fiber/v2 v2.52.12
github.com/gofiber/swagger v1.1.1
github.com/golang-jwt/jwt/v5 v5.3.0
Expand All @@ -30,7 +30,8 @@ require (
golang.org/x/crypto v0.49.0
google.golang.org/api v0.273.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
gorm.io/datatypes v1.2.7
gorm.io/gorm v1.30.0
)

require (
Expand All @@ -44,6 +45,7 @@ require (
cloud.google.com/go/longrunning v0.8.0 // indirect
cloud.google.com/go/monitoring v1.24.3 // indirect
cloud.google.com/go/storage v1.61.3 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.31.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 // indirect
Expand Down Expand Up @@ -134,7 +136,7 @@ require (
google.golang.org/grpc v1.79.3 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/driver/mysql v1.5.2 // indirect
gorm.io/driver/mysql v1.5.6 // indirect
gorm.io/driver/postgres v1.5.6 // indirect
gorm.io/driver/sqlite v1.5.5 // indirect
moul.io/zapgorm2 v1.3.0 // indirect
Expand Down
30 changes: 21 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ cloud.google.com/go/storage v1.61.3 h1:VS//ZfBuPGDvakfD9xyPW1RGF1Vy3BWUoVZXgW1KM
cloud.google.com/go/storage v1.61.3/go.mod h1:JtqK8BBB7TWv0HVGHubtUdzYYrakOQIsMLffZ2Z/HWk=
cloud.google.com/go/trace v1.11.7 h1:kDNDX8JkaAG3R2nq1lIdkb7FCSi1rCmsEtKVsty7p+U=
cloud.google.com/go/trace v1.11.7/go.mod h1:TNn9d5V3fQVf6s4SCveVMIBS2LJUqo73GACmq/Tky0s=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
firebase.google.com/go/v4 v4.19.0 h1:f5NMlC2YHFsncz00c2+ecBr+ZYlRMhKIhj1z8Iz0lD8=
firebase.google.com/go/v4 v4.19.0/go.mod h1:P7UfBpzc8+Z3MckX79+zsWzKVfpGryr6HLbAe7gCWfs=
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
Expand Down Expand Up @@ -50,8 +52,8 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/android-sms-gateway/client-go v1.12.9-0.20260519005959-eae21b02f80f h1:NdX7nE17ObbkQcVyJPeAsZ9kvVtCbHu0hdB4/12UkqM=
github.com/android-sms-gateway/client-go v1.12.9-0.20260519005959-eae21b02f80f/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.12.10-0.20260524050942-22cc236032cd h1:SmQFhgS3gOcCjkVBaslbxxgISlyvPIN9RVpMTT3Mv/A=
github.com/android-sms-gateway/client-go v1.12.10-0.20260524050942-22cc236032cd/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eTWro=
github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM=
Expand Down Expand Up @@ -148,8 +150,8 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/gofiber/adaptor/v2 v2.2.1 h1:givE7iViQWlsTR4Jh7tB4iXzrlKBgiraB/yTdHs9Lv4=
github.com/gofiber/adaptor/v2 v2.2.1/go.mod h1:AhR16dEqs25W2FY/l8gSj1b51Azg5dtPDmm+pruNOrc=
github.com/gofiber/contrib/fiberzap/v2 v2.1.6 h1:8aMBaO7jAB4w9o2uGC1S3ieKPxg8vfJ7t1aipq2pudg=
Expand All @@ -165,6 +167,10 @@ github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXe
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
Expand Down Expand Up @@ -237,6 +243,8 @@ github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEj
github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/microsoft/go-mssqldb v1.7.2 h1:CHkFJiObW7ItKTJfHo1QX7QBBD1iV+mn1eOyRP3b/PA=
github.com/microsoft/go-mssqldb v1.7.2/go.mod h1:kOvZKUdrhhFQmxLZqbwUV0rHkNkZpthMITIb2Ko1IoA=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
Expand Down Expand Up @@ -461,16 +469,20 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs=
gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8=
gorm.io/datatypes v1.2.7 h1:ww9GAhF1aGXZY3EB3cJPJ7//JiuQo7DlQA7NNlVaTdk=
gorm.io/datatypes v1.2.7/go.mod h1:M2iO+6S3hhi4nAyYe444Pcb0dcIiOMJ7QHaUXxyiNZY=
gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/postgres v1.5.6 h1:ydr9xEd5YAM0vxVDY0X139dyzNz10spDiDlC7+ibLeU=
gorm.io/driver/postgres v1.5.6/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E=
gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE=
gorm.io/driver/sqlserver v1.6.0 h1:VZOBQVsVhkHU/NzNhRJKoANt5pZGQAS1Bwc6m6dgfnc=
gorm.io/driver/sqlserver v1.6.0/go.mod h1:WQzt4IJo/WHKnckU9jXBLMJIVNMVeTu25dnOzehntWw=
gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde h1:9DShaph9qhkIYw7QF91I/ynrr4cOO2PZra2PFD7Mfeg=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo=
Expand Down
22 changes: 20 additions & 2 deletions internal/sms-gateway/handlers/converters/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,35 @@ package converters

import (
"github.com/android-sms-gateway/client-go/smsgateway"
"github.com/android-sms-gateway/server/internal/sms-gateway/models"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/devices"
"github.com/capcom6/go-helpers/anys"
"github.com/samber/lo"
)

func DeviceToDTO(device models.Device) smsgateway.Device {
func DeviceToDTO(device devices.Device) smsgateway.Device {
return smsgateway.Device{
ID: device.ID,
Name: anys.OrDefault(device.Name, ""),
CreatedAt: device.CreatedAt,
UpdatedAt: device.UpdatedAt,
DeletedAt: device.DeletedAt,
LastSeen: device.LastSeen,
SimCards: mapSimCards(device.SimCards),
}
}

func mapSimCards(simCards []devices.SimCard) []smsgateway.SimCard {
if simCards == nil {
return nil
}

return lo.Map(simCards, func(sc devices.SimCard, _ int) smsgateway.SimCard {
return smsgateway.SimCard{
SlotIndex: sc.SlotIndex,
SimNumber: sc.SimNumber,
PhoneNumber: sc.PhoneNumber,
CarrierName: sc.CarrierName,
ICCID: sc.ICCID,
}
})
}
68 changes: 53 additions & 15 deletions internal/sms-gateway/handlers/converters/devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (

"github.com/android-sms-gateway/client-go/smsgateway"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/converters"
"github.com/android-sms-gateway/server/internal/sms-gateway/models"
"github.com/capcom6/go-helpers/anys"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/devices"
"github.com/go-playground/assert/v2"
"github.com/samber/lo"
)

func TestDeviceToDTO(t *testing.T) {
Expand All @@ -18,26 +18,27 @@ func TestDeviceToDTO(t *testing.T) {

tests := []struct {
name string
device models.Device
device devices.Device
expected smsgateway.Device
}{
{
name: "empty device",
device: models.Device{},
device: devices.Device{},
expected: smsgateway.Device{},
},
{
name: "non-empty device",
device: models.Device{
ID: "test-id",
Name: anys.AsPointer("test-name"),
LastSeen: lastSeenAt,
SoftDeletableModel: models.SoftDeletableModel{
TimedModel: models.TimedModel{
CreatedAt: createdAt,
UpdatedAt: updatedAt,
device: devices.Device{
DeviceInput: devices.DeviceInput{
DeviceInfo: devices.DeviceInfo{
DeviceUpdate: devices.DeviceUpdate{},
Name: lo.ToPtr("test-name"),
},
ID: "test-id",
},
LastSeen: lastSeenAt,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
},
expected: smsgateway.Device{
ID: "test-id",
Expand All @@ -49,15 +50,52 @@ func TestDeviceToDTO(t *testing.T) {
},
{
name: "device with nil name",
device: models.Device{
ID: "test-id",
Name: nil,
device: devices.Device{
DeviceInput: devices.DeviceInput{
DeviceInfo: devices.DeviceInfo{
Name: nil,
},
ID: "test-id",
},
},
expected: smsgateway.Device{
ID: "test-id",
Name: "",
},
},
{
name: "device with sim cards",
device: devices.Device{
DeviceInput: devices.DeviceInput{
DeviceInfo: devices.DeviceInfo{
DeviceUpdate: devices.DeviceUpdate{
SimCards: []devices.SimCard{
{
SlotIndex: 0,
SimNumber: 1,
PhoneNumber: lo.ToPtr("+79990001234"),
CarrierName: lo.ToPtr("Carrier"),
ICCID: lo.ToPtr("8901260000000000000"),
},
},
},
},
ID: "test-id",
},
},
expected: smsgateway.Device{
ID: "test-id",
SimCards: []smsgateway.SimCard{
{
SlotIndex: 0,
SimNumber: 1,
PhoneNumber: lo.ToPtr("+79990001234"),
CarrierName: lo.ToPtr("Carrier"),
ICCID: lo.ToPtr("8901260000000000000"),
},
},
},
},
}

for _, test := range tests {
Expand Down
16 changes: 10 additions & 6 deletions internal/sms-gateway/handlers/devices/3rdparty.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"errors"
"fmt"

"github.com/android-sms-gateway/client-go/smsgateway"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/base"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/converters"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/middlewares/permissions"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/middlewares/userauth"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/devices"
"github.com/capcom6/go-helpers/slices"
"github.com/go-playground/validator/v10"
"github.com/gofiber/fiber/v2"
"github.com/samber/lo"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -50,14 +51,17 @@ func NewThirdPartyController(
//
// List devices.
func (h *ThirdPartyController) get(userID string, c *fiber.Ctx) error {
devices, err := h.devicesSvc.Select(userID)
items, err := h.devicesSvc.Select(c.Context(), userID)
if err != nil {
return fmt.Errorf("failed to select devices: %w", err)
}

response := slices.Map(devices, converters.DeviceToDTO)

return c.JSON(response)
return c.JSON(lo.Map(
items,
func(device devices.Device, _ int) smsgateway.Device {
return converters.DeviceToDTO(device)
},
))
}

// @Summary Remove device
Expand All @@ -79,7 +83,7 @@ func (h *ThirdPartyController) get(userID string, c *fiber.Ctx) error {
func (h *ThirdPartyController) remove(userID string, c *fiber.Ctx) error {
id := c.Params("id")

err := h.devicesSvc.Remove(userID, devices.WithID(id))
err := h.devicesSvc.Remove(c.Context(), userID, devices.WithID(id))
if errors.Is(err, devices.ErrNotFound) {
return fiber.NewError(fiber.StatusNotFound, err.Error())
}
Expand Down
4 changes: 2 additions & 2 deletions internal/sms-gateway/handlers/events/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package events
import (
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/base"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/middlewares/deviceauth"
"github.com/android-sms-gateway/server/internal/sms-gateway/models"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/devices"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/sse"
"github.com/go-playground/validator/v10"
"github.com/gofiber/fiber/v2"
Expand Down Expand Up @@ -42,7 +42,7 @@ func NewMobileController(sseService *sse.Service, validator *validator.Validate,
// @Router /mobile/v1/events [get]
//
// Get events.
func (h *MobileController) get(device models.Device, c *fiber.Ctx) error {
func (h *MobileController) get(device devices.Device, c *fiber.Ctx) error {
return h.sseSvc.Handler(device.ID, c) //nolint:wrapcheck //wrapped internally
}

Expand Down
5 changes: 3 additions & 2 deletions internal/sms-gateway/handlers/messages/3rdparty.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (h *ThirdPartyController) post(userID string, c *fiber.Ctx) error {
}

device, err := h.devicesSvc.GetAny(
c.Context(),
userID,
req.DeviceID,
time.Duration(params.DeviceActiveWithin)*time.Hour,
Expand Down Expand Up @@ -249,14 +250,14 @@ func (h *ThirdPartyController) get(userID string, c *fiber.Ctx) error {
//
// Deprecated: use /3rdparty/v1/inbox/refresh instead.
func (h *ThirdPartyController) postInboxExport(userID string, c *fiber.Ctx) error {
req := new(smsgateway.MessagesExportRequest)
req := new(smsgateway.InboxRefreshRequest)
if err := h.BodyParserValidator(c, req); err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}

if err := h.inboxSvc.Refresh(
userID,
&req.DeviceID,
req.DeviceID,
req.Since,
req.Until,
[]smsgateway.IncomingMessageType{smsgateway.IncomingMessageTypeSMS},
Expand Down
6 changes: 3 additions & 3 deletions internal/sms-gateway/handlers/messages/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/base"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/converters"
"github.com/android-sms-gateway/server/internal/sms-gateway/handlers/middlewares/deviceauth"
"github.com/android-sms-gateway/server/internal/sms-gateway/models"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/devices"
"github.com/android-sms-gateway/server/internal/sms-gateway/modules/messages"
"github.com/capcom6/go-helpers/slices"
"github.com/go-playground/validator/v10"
Expand Down Expand Up @@ -55,7 +55,7 @@ func NewMobileController(params mobileControllerParams) *MobileController {
// @Router /mobile/v1/message [get]
//
// Get messages for sending.
func (h *MobileController) list(device models.Device, c *fiber.Ctx) error {
func (h *MobileController) list(device devices.Device, c *fiber.Ctx) error {
// Get and validate order parameter
params := new(mobileGetQueryParams)
if err := h.QueryParserValidator(c, params); err != nil {
Expand Down Expand Up @@ -90,7 +90,7 @@ func (h *MobileController) list(device models.Device, c *fiber.Ctx) error {
// @Router /mobile/v1/message [patch]
//
// Update message state.
func (h *MobileController) patch(device models.Device, c *fiber.Ctx) error {
func (h *MobileController) patch(device devices.Device, c *fiber.Ctx) error {
req := smsgateway.MobilePatchMessageRequest{}
if err := h.BodyParserValidator(c, &req); err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
Expand Down
Loading
Loading