Documentation ¶
Index ¶
Constants ¶
View Source
const ( ACCESS_TOKEN_EXPIRATION = time.Duration(24*365) * time.Hour CONTEXT_SESSION_KEY internal.ContextKey = "auth:session" CONTEXT_USER_KEY internal.ContextKey = "auth:user" )
View Source
const ( COMMUNITY_ADDRESS_MAX_LENGTH = 100 COMMUNITY_ADDRESS_MIN_LENGTH = 1 COMMUNITY_NAME_MAX_LENGTH = 100 COMMUNITY_NAME_MIN_LENGTH = 1 )
View Source
const ( MEMBERSHIP_DOOR_MAX_LENGTH = 25 MEMBERSHIP_DOOR_MIN_LENGTH = 0 )
View Source
const ( OTP_CODE_LENGTH = 6 OTP_MAX_ATTEMPTS = 5 OTP_EXPIRATION = time.Duration(5) * time.Minute )
View Source
const ( POST_MESSAGE_MAX_LENGTH = 280 POST_MESSAGE_MIN_LENGTH = 1 POST_POLL_WIDGET_MAX_OPTIONS = 5 POST_POLL_WIDGET_MIN_OPTIONS = 2 POST_POLL_WIDGET_MAX_OPTION_LENGTH = 100 POST_POLL_WIDGET_MIN_OPTION_LENGTH = 1 )
View Source
const ( USER_NAME_MAX_LENGTH = 100 USER_NAME_MIN_LENGTH = 1 USER_DEFAULT_PICTURE = "https://eu.ui-avatars.com/api/?name=%s&size=128" )
View Source
const (
INVITATION_EXPIRATION = time.Duration(24*30) * time.Hour
)
Variables ¶
View Source
var (
COMMUNITY_DEFAULT_CATEGORIES = []string{
"Suministros",
"Desagües",
"Cerrajería",
"Ascensor",
"Estructural",
"Zonas Comunes",
"Otros",
}
)
View Source
var MembershipRole = struct { ADMINISTRATOR string PRESIDENT string SECRETARY string RESIDENT string LESSEE string Has func(role string) bool }{"ADMINISTRATOR", "PRESIDENT", "SECRETARY", "RESIDENT", "LESSEE", func(role string) bool { return role == "ADMINISTRATOR" || role == "PRESIDENT" || role == "SECRETARY" || role == "RESIDENT" || role == "LESSEE" }, }
View Source
var OTPType = struct { SMS string EMAIL string Has func(typee string) bool }{"SMS", "EMAIL", func(typee string) bool { return typee == "SMS" || typee == "EMAIL" }}
View Source
var PostState = struct { PENDING string IN_PROGRESS string REJECTED string ACCEPTED string RESOLVED string Has func(role string) bool }{"PENDING", "IN_PROGRESS", "REJECTED", "ACCEPTED", "RESOLVED", func(role string) bool { return role == "PENDING" || role == "IN_PROGRESS" || role == "REJECTED" || role == "ACCEPTED" || role == "RESOLVED" }, }
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct { class.Model Private AccessTokenPrivate Public AccessTokenPublic }
func NewAccessToken ¶
func NewAccessToken() *AccessToken
func (*AccessToken) Copy ¶
func (self *AccessToken) Copy() *AccessToken
func (AccessToken) String ¶
func (self AccessToken) String() string
type AccessTokenPrivate ¶
type AccessTokenPrivate struct { SessionID string `json:"session_id"` CreatedAt time.Time `json:"created_at"` // Redundant field in order not to hit the DB to validate session expiration ExpiresAt time.Time `json:"expires_at"` }
func (*AccessTokenPrivate) Valid ¶
func (self *AccessTokenPrivate) Valid() error
Needed for Paseto library (Validation will be performed in the usecase)
type AccessTokenPublic ¶
type AccessTokenPublic struct {
ApiVersion string `json:"api_version"`
}
type Community ¶
type Community struct { class.Model ID string `db:"id"` Address string `db:"address"` Name string `db:"name"` Categories []string `db:"categories"` PinnedIDs []string `db:"pinned_ids"` CreatedAt time.Time `db:"created_at"` DeletedAt *time.Time `db:"deleted_at"` }
func NewCommunity ¶
func NewCommunity() *Community
type Invitation ¶
type Invitation struct { class.Model ID string `db:"id"` Phone string `db:"phone"` CommunityID string `db:"community_id"` Door string `db:"door"` Role string `db:"role"` CreatedAt time.Time `db:"created_at"` RemindedAt time.Time `db:"reminded_at"` ExpiresAt time.Time `db:"expires_at"` }
func NewInvitation ¶
func NewInvitation() *Invitation
func (*Invitation) Copy ¶
func (self *Invitation) Copy() *Invitation
func (Invitation) String ¶
func (self Invitation) String() string
type Membership ¶
type Membership struct { class.Model ID string `db:"id"` UserID string `db:"user_id"` CommunityID string `db:"community_id"` Door string `db:"door"` Role string `db:"role"` CreatedAt time.Time `db:"created_at"` DeletedAt *time.Time `db:"deleted_at"` }
func NewMembership ¶
func NewMembership() *Membership
func (*Membership) Copy ¶
func (self *Membership) Copy() *Membership
func (Membership) String ¶
func (self Membership) String() string
type OTP ¶
type Post ¶
type Post struct { class.Model ID string `db:"id"` ThreadID *string `db:"thread_id"` CreatorID string `db:"creator_id"` LastHistoryID *string `db:"last_history_id"` Type string `db:"type"` Priority *int `db:"priority"` RecipientIDs *[]string `db:"recipient_ids"` VoterIDs []string `db:"voter_ids"` CreatedAt time.Time `db:"created_at"` }
type PostHistory ¶
type PostHistory struct { class.Model ID string `db:"id"` PostID string `db:"post_id"` UpdatorID string `db:"updator_id"` Message string `db:"message"` Categories []string `db:"categories"` State *string `db:"state"` Media []string `db:"media"` Widgets PostWidgets `db:"widgets"` CreatedAt time.Time `db:"created_at"` }
func NewPostHistory ¶
func NewPostHistory() *PostHistory
func (*PostHistory) Copy ¶
func (self *PostHistory) Copy() *PostHistory
func (PostHistory) String ¶
func (self PostHistory) String() string
type PostWidgets ¶
type Session ¶
type Session struct { class.Model ID string `db:"id"` UserID string `db:"user_id"` Metadata SessionMetadata `db:"metadata"` CreatedAt time.Time `db:"created_at"` LastSeenAt time.Time `db:"last_seen_at"` ExpiredAt *time.Time `db:"expired_at"` }
func NewSession ¶
func NewSession() *Session
type SessionMetadata ¶
type User ¶
type User struct { class.Model ID string `db:"id"` Phone string `db:"phone"` Name string `db:"name"` Email string `db:"email"` Picture string `db:"picture"` Birthday date.Date `db:"birthday"` Language string `db:"language"` LastSessionID *string `db:"last_session_id"` IsBanned bool `db:"is_banned"` CreatedAt time.Time `db:"created_at"` DeletedAt *time.Time `db:"deleted_at"` }
Click to show internal directories.
Click to hide internal directories.