model

package
v0.0.0-...-09b6e72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: GPL-3.0 Imports: 17 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptJoinRequest

func AcceptJoinRequest(user string, org string) error

func AddPolicy

func AddPolicy(who, resource, access string) error

func AuthorizeUser

func AuthorizeUser(ctx context.Context) (bool, error)

func ConnectEnforcer

func ConnectEnforcer()

connect policy enforcer and wrappers around it

func ConnectToDB

func ConnectToDB() bolt.Conn

connect to neo

func CreateAttendee

func CreateAttendee(eventName string, p Participant, c chan error, mutex *sync.Mutex)

func CreateAttendeeSync

func CreateAttendeeSync(eventName string, p Participant, mutex *sync.Mutex) error

func CreateCouponSchema

func CreateCouponSchema(event string, coupons []Coupon, c chan error)

func CreateEvent

func CreateEvent(e Event, ce chan error)

func CreateGuest

func CreateGuest(event string, g Guest, c chan error, mutex *sync.Mutex)

create a new guest node with relationship to the event

func CreateJoinRequest

func CreateJoinRequest(user string, org string) error

func CreateNewOrg

func CreateNewOrg(org Organization, user string) error

func CreateParticipant

func CreateParticipant(e Event, label string, c chan error, mutex *sync.Mutex)

create a new node with given label and participant data struct (FOR COORDINATORS)

func DBInit

func DBInit(c bolt.Conn)

func DeleteAttendee

func DeleteAttendee(q Query, c chan error)

func DeleteCouponSchema

func DeleteCouponSchema(event string, q Coupon, c chan MessageReturn)

func DeleteEvent

func DeleteEvent(q Query, c chan error)

delete event with given query

func DenyJoinRequest

func DenyJoinRequest(user, org string) error

func Enforce

func Enforce(who, resource, access string) bool

func EnforceRoleAdmin

func EnforceRoleAdmin(email, org string) (bool, error)

func EnforceRoleEither

func EnforceRoleEither(email, org string) (bool, error)

func EnforceRoleMember

func EnforceRoleMember(email, org string) (bool, error)

func GetAuth

func GetAuth(resource string) []string

func GetUserDetails

func GetUserDetails(user string) (events []Event, orgs []Organization, err error)

func InviteUserToOrg

func InviteUserToOrg(email, org string) error

func IsEventOfOrg

func IsEventOfOrg(eventname, orgname string) (bool, error)

func Login

func Login(email string, password string, organization string, role string) (token string, err error)

func MarkPresent

func MarkPresent(attendance Attendance, c chan MessageReturn)

func ReadAttendee

func ReadAttendee(q Query, c chan ParticipantReturn, mutex *sync.Mutex)

func ReadGuest

func ReadGuest(q Query, c chan GuestReturn)

func RedeemCoupon

func RedeemCoupon(attendance Attendance, couponName string, c chan MessageReturn)

func RemovePolicy

func RemovePolicy(who, resource, access string) error

func RmAttendee

func RmAttendee(q Query, c chan error)

func RmGuest

func RmGuest(q Query, c chan error)

func ShowEventData

func ShowEventData(q Query, c chan EventReturn)

func TokenGen

func TokenGen(email string, role string, organization string, c chan TokenReturn)

func UpdateAttendee

func UpdateAttendee(q Query, c chan error)

func UpdateEvent

func UpdateEvent(q Query, c chan error)

update event with given query and new value

func ViewAbsent

func ViewAbsent(event string, query Query, day int, c chan SafeParticipantReturn)

func ViewAll

func ViewAll(event string, query Query, c chan SafeParticipantReturn, mutex *sync.Mutex)

func ViewCouponSchema

func ViewCouponSchema(event string, mutex *sync.Mutex, c chan CouponReturn)

func ViewPresent

func ViewPresent(event string, query Query, day int, c chan SafeParticipantReturn, mutex *sync.Mutex)

Types

type Attendance

type Attendance struct {
	EventName  string `json:"eventName"`
	Email      string `json:"email"`
	Day        int    `json:"day"`
	CouponName string `json:"couponName"`
}

type Attendee

type Attendee struct {
	Name               string `json:"name"`
	RegistrationNumber string `json:"registrationNumber"`
	Email              string `json:"email"`
	PhoneNumber        string `json:"phoneNumber"`
	Gender             string `json:"gender"`
	EventName          string `json:"eventName"`
}

type Coupon

type Coupon struct {
	Name string `json:"name"`
	Desc string `json:"description"`
	Day  int    `json:"day"`
}

type CouponReturn

type CouponReturn struct {
	Coupons []Coupon `json:"coupons"`
	Err     error    `json:"err"`
}

type Event

type Event struct {
	ClubName              string      `json:"clubName"`
	Name                  string      `json:"name"`
	ToDate                string      `json:"toDate"`
	FromDate              string      `json:"fromDate"`
	ToTime                string      `json:"toTime"`
	FromTime              string      `json:"fromTime"`
	Budget                string      `json:"budget"`
	Description           string      `json:"description"`
	Category              string      `json:"category"`
	Venue                 string      `json:"venue"`
	Attendance            string      `json:"attendance"`
	ExpectedParticipants  string      `json:"expectedParticipants"`
	FacultyCoordinator    Participant `json:"facultyCoordinator"`
	StudentCoordinator    Participant `json:"studentCoordinator"`
	PROrequest            string      `json:"PROrequest"`
	CampusEngineerRequest string      `json:"campusEngineerRequest"`
	Duration              string      `json:"duration"`
	// MainSponsor           Participant `json:"mainSponsor"`
	Status string `json:"status"`
}

func ReadEventsByOrg

func ReadEventsByOrg(org string) (events []Event, err error)

func (Event) GetField

func (v Event) GetField(field string, value string) string

type EventReturn

type EventReturn struct {
	Event []Event `json:"event"`
	Err   error   `json:"err"`
}

type Guest

type Guest struct {
	Name           string `json:"name"`
	Email          string `json:"email"`
	PhoneNumber    string `json:"phoneNumber"`
	Gender         string `json:"gender"`
	Stake          string `json:"stake"`
	LocationOfStay string `json:"locationOfStay"`
}

type GuestReturn

type GuestReturn struct {
	Guests []Guest
	Err    error
}

type MessageReturn

type MessageReturn struct {
	Message string
	Err     error
}

type Organization

type Organization struct {
	Name        string `json:"name"`
	Location    string `json:"location"`
	Description string `json:"description"`
	Tag         string `json:"tag"`
	CreatedAt   string `json:"createdAt"`
	Website     string `json:"website"`
}

func GetOrgs

func GetOrgs(org string) ([]Organization, error)

func GetUserDetailsOnlyOrg

func GetUserDetailsOnlyOrg(user string) (orgs []Organization, err error)

type Participant

type Participant struct {
	Name               string `json:"name"`
	RegistrationNumber string `json:"registrationNumber"`
	Email              string `json:"email"`
	PhoneNumber        string `json:"phoneNumber"`
	Gender             string `json:"gender"`
}

type ParticipantReturn

type ParticipantReturn struct {
	Attendees []Attendee `json:"attendee"`
	Err       error      `json:"err"`
}

type Query

type Query struct {
	Key          string `json:"key"`
	Value        string `json:"value"`
	ChangeKey    string `json:"changeKey"`
	ChangeValue  string `json:"changeValue"`
	Organization string `json:"organization"`
	Specific     string `json:"specific"`
}

type SafeParticipantReturn

type SafeParticipantReturn struct {
	Participants []Participant `json:"participants"`
	Err          error         `json:"err"`
}

type Token

type Token struct {
	Email        string `json:"email"`
	Role         string `json:"role"`
	Organization string `json:"organization"`
	jwt.StandardClaims
}

func ValidateToken

func ValidateToken(token string) (tk Token, err error)

func VerifyToken

func VerifyToken(ctx context.Context) (tk Token, err error)

type TokenReturn

type TokenReturn struct {
	Token   string
	Err     error
	Message string
}

type User

type User struct {
	FirstName   string `json:"firstName"`
	LastName    string `json:"lastName"`
	Password    string `json:"password"`
	Email       string `json:"email"`
	PhoneNumber string `json:"phoneNumber"`
	LinkedIn    string `json:"linkedIn"`
	Facebook    string `json:"facebook"`
	Description string `json:"description"`
	CreatedAt   string `json:"createdAt"`
	DeviceToken string `json:"deviceToken"`
}

role as relation

func GetJoinRequests

func GetJoinRequests(org string) ([]User, error)

func (*User) Get

func (u *User) Get(c chan UserReturn)

type UserReturn

type UserReturn struct {
	User    User
	Err     error
	Message string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL