Documentation ¶
Index ¶
- Constants
- Variables
- func GetOffsetLinksForPGParams(r *http.Request, p pgdb.OffsetPageParams) *resources.Links
- type Chat
- type Chats
- type Link
- type Links
- type MessageInfo
- type ModulePayload
- type ModuleRequest
- type OrderType
- type Permission
- type Permissions
- type Response
- type Responses
- type UnverifiedPayload
- type UnverifiedUser
- type User
- type Users
Constants ¶
View Source
const ( ModuleName = "telegram" UnverifiedService = "unverified-svc" IdentityService = "identity" )
View Source
const ( S3BucketName = "accesscontrolsystem" S3BucketEndpoint = "https://accesscontrolsystem.s3.eu-north-1.amazonaws.com" )
View Source
const ( OrderAscending = "asc" OrderDescending = "desc" )
View Source
const ( Owner = "owner" Admin = "admin" Member = "member" Left = "left" Self = "self" Banned = "banned" )
View Source
const ( SUCCESS = "success" FAILURE = "failure" INVITED = "invited" )
View Source
const InviteMessageTemplate = `` /* 227-byte string literal not displayed */
Variables ¶
View Source
var Roles = map[string]string{
Admin: "Admin",
Member: "Member",
Owner: "Owner",
Self: "Self",
Left: "Left",
Banned: "Banned",
}
Functions ¶
Types ¶
type Chat ¶
type Chat struct { Title string `json:"title" db:"title" structs:"title"` Id int64 `json:"id" db:"id" structs:"id"` AccessHash *int64 `json:"access_hash" db:"access_hash" structs:"access_hash"` MembersAmount int64 `json:"members_amount" db:"members_amount" structs:"members_amount"` PhotoName *string `json:"photo_name" db:"photo_name" structs:"photo_name"` PhotoLink *string `json:"photo_link" db:"photo_link" structs:"photo_link"` }
type MessageInfo ¶
type ModulePayload ¶
type ModulePayload struct { RequestId string `json:"request_id"` UserId string `json:"user_id"` Action string `json:"action"` //other fields that are required for module Link string `json:"link"` SubmoduleId int64 `json:"submodule_id"` SubmoduleAccessHash *int64 `json:"submodule_access_hash"` Links []string `json:"links"` Username *string `json:"username"` Phone *string `json:"phone"` AccessLevel string `json:"access_level"` }
type ModuleRequest ¶
type ModuleRequest struct { ID string `db:"id" structs:"id"` UserID int64 `db:"user_id" structs:"user_id"` Module string `db:"module" structs:"module"` Payload string `db:"payload" structs:"payload"` CreatedAt time.Time `db:"created_at" structs:"created_at"` RequestStatus string `db:"request_status" structs:"request_status"` Error string `db:"error" structs:"error"` }
type Permission ¶
type Permission struct { RequestId string `json:"request_id" db:"request_id" structs:"request_id"` TelegramId int64 `json:"telegram_id" db:"telegram_id" structs:"telegram_id"` AccessLevel string `json:"access_level" db:"access_level" structs:"access_level"` Link string `json:"link" db:"link" structs:"link"` SubmoduleId int64 `json:"submodule_id" db:"submodule_id" structs:"submodule_id"` SubmoduleAccessHash *int64 `json:"submodule_access_hash" db:"submodule_access_hash" structs:"submodule_access_hash"` CreatedAt time.Time `json:"created_at" db:"created_at" structs:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at" structs:"-"` *User `structs:",omitempty"` }
type Permissions ¶
type Permissions interface { New() Permissions Upsert(permission Permission) error UpdateAccessLevel(permission Permission) error Delete() error Select() ([]Permission, error) Get() (*Permission, error) FilterByTelegramIds(telegramIds ...int64) Permissions FilterByLinks(links ...string) Permissions FilterByGreaterTime(time time.Time) Permissions FilterByLowerTime(time time.Time) Permissions SearchBy(search string) Permissions WithUsers() Permissions FilterByUserIds(userIds ...int64) Permissions Count() Permissions CountWithUsers() Permissions GetTotalCount() (int64, error) Page(pageParams pgdb.OffsetPageParams) Permissions }
type Response ¶
type Response struct { ID string `json:"id" db:"id" structs:"id"` Status string `json:"status" db:"status" structs:"status"` Error *string `json:"error,omitempty" db:"error,omitempty" structs:"error,omitempty"` Description *string `json:"description,omitempty" db:"description,omitempty" structs:"description,omitempty"` Payload json.RawMessage `json:"payload" db:"payload" structs:"payload"` CreatedAt string `json:"created_at" db:"created_at" structs:"-"` }
type UnverifiedPayload ¶
type UnverifiedPayload struct { Action string `json:"action"` Users []UnverifiedUser `json:"users"` }
type UnverifiedUser ¶
type UnverifiedUser struct { CreatedAt time.Time `json:"created_at"` Module string `json:"module"` Submodule string `json:"submodule"` ModuleId string `json:"module_id"` Email *string `json:"email,omitempty"` Name *string `json:"name,omitempty"` Phone *string `json:"phone,omitempty"` Username *string `json:"username,omitempty"` }
type User ¶
type User struct { Id *int64 `json:"-" db:"id" structs:"id,omitempty"` Username *string `json:"username" db:"username" structs:"username,omitempty"` Phone *string `json:"phone" db:"phone" structs:"phone,omitempty"` FirstName string `json:"first_name" db:"first_name" structs:"first_name"` LastName string `json:"last_name" db:"last_name" structs:"last_name"` TelegramId int64 `json:"telegram_id" db:"telegram_id" structs:"telegram_id"` AccessHash int64 `json:"access_hash" db:"access_hash" structs:"access_hash"` CreatedAt time.Time `json:"created_at" db:"created_at" structs:"-"` UpdatedAt time.Time `json:"updated_at" db:"updated_at" structs:"-"` Module string `json:"module" db:"-" structs:"-"` Submodule *string `json:"-" db:"-" structs:"-"` // fields to create permission AccessLevel string `json:"-" db:"-" structs:"-"` }
type Users ¶
type Users interface { New() Users Upsert(user User) error Delete() error Select() ([]User, error) Get() (*User, error) FilterByLowerTime(time time.Time) Users FilterById(id *int64) Users FilterByTelegramIds(telegramIds ...int64) Users FilterByUsername(username string) Users FilterByPhone(phone string) Users SearchBy(search string) Users Count() Users GetTotalCount() (int64, error) Page(pageParams pgdb.OffsetPageParams) Users }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.