for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package entities
import (
"time"
"github.com/google/uuid"
)
// Phone represents an android phone which has installed the http sms app
type Phone struct {
ID uuid.UUID `json:"id" gorm:"primaryKey;type:uuid;" example:"32343a19-da5e-4b1b-a767-3298a73703cb"`
UserID UserID `json:"user_id" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"`
FcmToken *string `json:"fcm_token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzd....."`
PhoneNumber string `json:"phone_number" example:"+18005550199"`
MessagesPerMinute uint `json:"messages_per_minute" example:"1"`
// MessageExpirationSeconds is the duration in seconds after sending a message when it is considered to be expired.
MessageExpirationSeconds uint `json:"message_expiration_seconds"`
CreatedAt time.Time `json:"created_at" example:"2022-06-05T14:26:02.302718+03:00"`
UpdatedAt time.Time `json:"updated_at" example:"2022-06-05T14:26:10.303278+03:00"`
}
// MessageExpirationDuration returns the message expiration as time.Duration
func (phone *Phone) MessageExpirationDuration() time.Duration {
return time.Duration(phone.MessageExpirationSeconds) * time.Second