services

package
v0.0.0-...-a7c99a5 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2018 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountServiceInterface

type AccountServiceInterface interface {
	Login(models.Account) (int64, error)
	SaveToken(models.Account, string) (bool, error)
	CheckExistToken(int64, string) (bool, error)
	DeleteToken(int64, string) (bool, error)
	Create(models.User) (int64, error)

	GetDeviceByUserID(int64) ([]string, error)
	CheckExistUsername(username string) (bool, error)
	CheckExistEmail(email string) (bool, error)
	CreateEmailActive(email string, activeCode string, userID int64) (bool, error)

	CreateRecoverPassword(email string, recoveryCode string) (bool, error)
	VerifyRecoveryCode(email string, recoveryCode string) (int64, error)
	AddUserRecoveryKey(userID int64, recoveryKey string) error
	RenewPassword(userID int64, recoveryKey string, newPassword string) (bool, error)
	DeleteRecoveryProperty(userID int64) (bool, error)
	CheckExistFacebookID(facebookID string) (int64, error)

	ActiveByEmail(userID int64, activeCode string) (bool, error)
	DeleteActiveCode(userID int64) (bool, error)

	GetRoleFromUserID(userID int64) (int, error)
	GetCodeFromUserID(userID int64) (string, error)
	// AddRoleAndCodeToAccount(account models.Account) (models.Account, error)
	GetDeviceByUserIDs(accountIDs []int64) ([]string, error)
}

AccountServiceInterface include method list

func NewAccountService

func NewAccountService() AccountServiceInterface

NewAccountService contructor

type ChannelNotificationServiceInterface

type ChannelNotificationServiceInterface interface {
	GetAll(params helpers.ParamsGetAll, myUserID int64) ([]models.ChannelNotification, error)
	Get(channelNotificationID int64) (models.ChannelNotification, error)
	Delete(channelNotificationID int64) (bool, error)
	Create(channelNotification models.ChannelNotification, channelID int64) (int64, error)
	Update(channelNotification models.ChannelNotification) (models.ChannelNotification, error)
	CheckExistChannelNotification(channelNotificationID int64) (bool, error)

	GetAllOfChannel(params helpers.ParamsGetAll, channelID int64) ([]models.ChannelNotification, error)
	CheckPermission(channelID int64, myUserID int64) (bool, error)
	CheckPermissionByNotificationID(channelNotificationID int64, myUserID int64) (bool, error)
}

ChannelNotificationServiceInterface include method list

func NewChannelNotificationService

func NewChannelNotificationService() ChannelNotificationServiceInterface

NewChannelNotificationService to constructor

type ChannelServiceInterface

type ChannelServiceInterface interface {
	//  Normal User
	GetAll(params helpers.ParamsGetAll, myUserID int64) ([]models.Channel, error)
	Get(channelID int64, myUserID int64) (models.Channel, error)

	CheckExistChannel(channelID int64) (bool, error)
	CheckUserRole(channelID int64, userID int64) (int, error)
	CheckExistFollowChannel(channelID int64, userID int64) (int64, error)
	GetFollowers(params helpers.ParamsGetAll, channelID int64, myUserID int64) ([]models.UserFollowObject, error)
	CreateFollower(channelID int64, myUserID int64) (bool, error)
	DeleteFollower(subcriptionID int64) (bool, error)
	GetFollowedChannels(params helpers.ParamsGetAll, userID int64, myUserID int64) ([]models.ChannelObject, error)

	// Only Admin
	Create(channel models.Channel, adminID int64) (int64, error)
	Update(channelID int64, newChannel models.InfoChannel) (models.Channel, error)
	Delete(channelID int64) (bool, error)
}

ChannelServiceInterface include method list

func NewChannelService

func NewChannelService() ChannelServiceInterface

NewChannelService to constructor

type ClassServiceInterface

type ClassServiceInterface interface {
	// Admin
	GetAll(params helpers.ParamsGetAll) ([]models.Class, error)

	//update from TLU
	UpdateFromTLU(semesterCode string) (bool, error)

	// A Student
	GetAllByStudent(params helpers.ParamsGetAll, semesterCode string, studentCode string) ([]models.Class, error)
	GetAllByRoom(params helpers.ParamsGetAll, day string, roomCode string) ([]models.Class, error)

	GetAllByTeacher(params helpers.ParamsGetAll, semesterCode string, teacherCode string) ([]models.Class, error)
}

ClassServiceInterface include method list

func NewClassService

func NewClassService() ClassServiceInterface

NewClassService to constructor

type CommentServiceInterface

type CommentServiceInterface interface {
	GetAll(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.Comment, error)
	Get(commentID int64) (models.Comment, error)
	Create(comment models.Comment, postID int64) (int64, error)
	CreateWithMention(comment models.Comment, postID int64) (int64, error)
	Delete(commentID int64) (bool, error)
	Update(comment models.Comment) (bool, error)
	CheckExistComment(commentID int64) (bool, error)
	GetUserIDByComment(commentID int64) (int64, error)
	GetPostIDbyComment(commentID int64) (int64, error)
	CheckPostInteractivePermission(postID int64, userID int64) (bool, error)
}

CommentServiceInterface include method list

func NewCommentService

func NewCommentService() CommentServiceInterface

NewCommentService to constructor

type ExamScheduleServiceInterface

type ExamScheduleServiceInterface interface {
	// Admin
	GetAll(params helpers.ParamsGetAll) ([]models.ExamSchedule, error)

	//update from TLU
	UpdateFromTLU(semesterCode string) (bool, error)

	// A Student
	GetAllByStudent(params helpers.ParamsGetAll, semesterCode string, studentCode string) ([]models.ExamSchedule, error)
}

ExamScheduleServiceInterface include method list

func NewExamScheduleService

func NewExamScheduleService() ExamScheduleServiceInterface

NewExamScheduleService to constructor

type GroupMembershipServiceInterface

type GroupMembershipServiceInterface interface {
	GetAll(params helpers.ParamsGetAll, groupID int64, myUserID int64) ([]models.GroupMembership, error)
	Get(membershipID int64) (models.GroupMembership, error)
	Delete(membershipID int64) (bool, error)
	DeleteByUser(groupID int64, userID int64) (bool, error)
	Create(groupID int64, userID int64) (int64, error)
	Update(membership models.GroupMembership) (models.GroupMembership, error)
	CheckExistGroupMembership(groupID int64, userID int64) (bool, error)
	GetAdmin(groupID int64) ([]int64, error)
}

GroupMembershipServiceInterface include method list

func NewGroupMembershipService

func NewGroupMembershipService() GroupMembershipServiceInterface

NewGroupMembershipService to constructor

type GroupServiceInterface

type GroupServiceInterface interface {
	GetAll(params helpers.ParamsGetAll, myUserID int64) ([]models.GroupJoin, error)
	Get(groupID int64, myUserID int64) (models.GroupJoin, error)
	Delete(groupID int64) (bool, error)
	Create(group models.Group, myUserID int64) (int64, error)
	Update(groupID int64, newGroup models.InfoGroup) (models.Group, error)
	CheckExistGroup(groupID int64) (bool, error)
	CheckUserRole(groupID int64, userID int64) (int, error)
	GetJoinedGroup(params helpers.ParamsGetAll, userID int64, myUserID int64) ([]models.GroupJoin, error)
	GetClassGroupOfStudent(params helpers.ParamsGetAll, studentCode string, userID int64) ([]models.GroupJoin, error)

	GetMembers(params helpers.ParamsGetAll, groupID int64) ([]models.GroupMembership, error)
	GetPendingUsers(params helpers.ParamsGetAll, groupID int64) ([]models.PendingUser, error)
	GetBlockedUsers(params helpers.ParamsGetAll, groupID int64) ([]models.UserFollowObject, error)

	CreateMember(groupID int64, userID int64) (bool, error)

	IncreasePosts(groupID int64) (bool, error)
	DecreasePosts(groupID int64) (bool, error)
}

GroupServiceInterface include method list

func NewGroupService

func NewGroupService() GroupServiceInterface

NewGroupService to constructor

type HomeServiceInterface

type HomeServiceInterface interface {
	FindUserByUsernameAndFullName(name string, myUserID int64) ([]models.UserFollowObject, error)
	GetNewsFeed(params helpers.ParamsGetAll, myUserID int64) ([]models.Post, error)
	GetNewsFeedWithPageRank(params helpers.ParamsGetAll, myUserID int64) ([]models.Post, error)
}

HomeServiceInterface include method list

func NewHomeService

func NewHomeService() HomeServiceInterface

NewHomeService to constructor

type NotificationServiceInterface

type NotificationServiceInterface interface {
	GetAll(params helpers.ParamsGetAll, userID int64) ([]models.Notification, error)
	Get(notificationID int64) (models.Notification, error)
	Delete(notificationID int64) (bool, error)
	Create(notification models.Notification, myUserID int64) (int64, error)
	Update(notification models.Notification) (models.Notification, error)

	GetNotificationSubcriber(notificationID int64) ([]int64, error)
	CreateNotificationSubcription(objectID int64, userID int64) (bool, error)
	CreateNotificationSubcriptionList(objectID int64, userIDs []int64) (bool, error)
	// user have seen noti and click
	SeenNotification(notificationID int64, userID int64) (bool, error)
	CheckSeenNotification(notificationID int64, userID int64) (bool, error)

	// Update if action is excute
	UpdateLikeNotification(postID int64) (models.Notification, error)
	UpdateFollowNotification(userID int64, objectID int64) (models.Notification, error)
	UpdateStatusNotification(userID int64) (models.Notification, error)
	UpdatePhotoNotification(userID int64) (models.Notification, error)
	UpdateCommentNotification(postID int64) (models.Notification, error)
	UpdateMentionNotification(postID int64, userID int64) (models.Notification, error)
	UpdateLikedPostNotification(userID int64) (models.Notification, error)
	UpdateCommentedPostNotification(userID int64) (models.Notification, error)
	UpdateMentionedPostNotification(userID int64) (models.Notification, error)
	UpdateRequestJoinNotification(groupID int64) (models.Notification, error)
}

NotificationServiceInterface include method list

func NewNotificationService

func NewNotificationService() NotificationServiceInterface

NewNotificationService to constructor

type PostServiceInterface

type PostServiceInterface interface {
	GetAll(params helpers.ParamsGetAll, userID int64, myUserID int64) ([]models.Post, error)
	Get(postID int64, myUserID int64) (models.Post, error)
	Delete(postID int64) (bool, error)
	Create(post models.Post, myUserID int64) (int64, error)
	Update(post models.Post) (models.Post, error)
	CheckExistPost(postID int64) (bool, error)
	GetUserIDByPostID(postID int64) (int64, error)

	// work with likes
	CreateLike(postID int64, userID int64) (int, error)
	GetLikes(postID int64, myUserID int64, params helpers.ParamsGetAll) ([]models.UserLikedObject, error)
	DeleteLike(postID int64, userID int64) (int, error)
	CheckExistLike(postID int64, userID int64) (bool, error)
	CheckPostInteractivePermission(postID int64, userID int64) (bool, error)

	// work with FOLLOW
	CreateFollow(postID int64, userID int64) (int64, error)
	DeleteFollow(postID int64, userID int64) (bool, error)
	CheckExistFollow(postID int64, userID int64) (bool, error)

	// work with users (can_mention, mentioned, liked, commented, followed)
	GetUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)
	GetCanMentionedUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)
	GetMentionedUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)
	GetLikedUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)
	GetCommentedUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)
	GetFollowedUsers(postID int64, params helpers.ParamsGetAll, myUserID int64) ([]models.UserFollowObject, error)

	// work with group
	CreateGroupPost(post models.Post, groupID int64, userID int64) (int64, error)
	GetAllGroupPosts(params helpers.ParamsGetAll, groupID int64, myUserID int64) ([]models.Post, error)
}

PostServiceInterface include method list

func NewPostService

func NewPostService() PostServiceInterface

NewPostService to constructor

type SemesterServiceInterface

type SemesterServiceInterface interface {
	// User
	GetAllOfStudent(params helpers.ParamsGetAll, studentCode string) ([]models.Semester, error)
	GetAllOfTeacher(params helpers.ParamsGetAll, teacherCode string) ([]models.Semester, error)

	// Only Admin
	//update from TLU
	UpdateFromTLU(year string) (bool, error)
	GetAll(params helpers.ParamsGetAll) ([]models.Semester, error)
}

SemesterServiceInterface include method list

func NewSemesterService

func NewSemesterService() SemesterServiceInterface

NewSemesterService to constructor

type StudentServiceInterface

type StudentServiceInterface interface {
	GetAll(params helpers.ParamsGetAll) ([]models.Student, error)
	// Get(semesterID int64) (models.Semester, error)
	// Delete(semesterID int64) (bool, error)
	// Create(semester models.Semester) (int64, error)
	// Update(semester models.Semester) (models.Semester, error)
	CheckExistStudent(studentCode string) (bool, error)

	//update from TLU
	UpdateFromTLU(classCode string) (bool, error)

	GetStudentsEnrolledClass(params helpers.ParamsGetAll, classCode int64) ([]models.Student, error)
}

StudentServiceInterface include method list

func NewStudentService

func NewStudentService() StudentServiceInterface

NewStudentService to constructor

type SubjectServiceInterface

type SubjectServiceInterface interface {
	GetAll(params helpers.ParamsGetAll) ([]models.Subject, error)

	//update from TLU
	UpdateFromTLU(semesterCode string) (bool, error)
}

SubjectServiceInterface include method list

func NewSubjectService

func NewSubjectService() SubjectServiceInterface

NewSubjectService to constructor

type SubscriptionServiceInterface

type SubscriptionServiceInterface interface {
	CreateSubscription(fromID int64, toID int64) (int64, error)
	DeleteSubcription(fromID int64, toID int64) (bool, error)
	CheckExistSubscription(fromID int64, toID int64) (bool, error)
	GetSubscriptions(userID int64) ([]models.UserFollowObject, error)
	GetFollowers(userID int64) ([]models.UserFollowObject, error)
	GetFollowerIDs(userID int64) ([]int64, error)
	CheckExistObject(objectID int64, objectType string) (bool, error)
}

SubscriptionServiceInterface include method list

func NewSubscriberService

func NewSubscriberService() SubscriptionServiceInterface

NewSubscriberService to constructor

type TeacherServiceInterface

type TeacherServiceInterface interface {
	GetAll(params helpers.ParamsGetAll) ([]models.Teacher, error)

	//update from TLU
	UpdateFromTLU(semesterCode string) (bool, error)
}

TeacherServiceInterface include method list

func NewTeacherService

func NewTeacherService() TeacherServiceInterface

NewTeacherService to constructor

type UserServiceInterface

type UserServiceInterface interface {
	GetAll(helpers.ParamsGetAll) (models.PublicUsers, error)
	Get(int64) (models.PublicUser, error)
	Delete(int64) (bool, error)
	Create(models.User) (int64, error)
	Update(userID int64, newUser models.InfoUser) (models.User, error)
	CheckExistUsername(string) (bool, error)
	CheckExistEmail(string) (bool, error)
	CreateEmailActive(string, string, int64) error
	CheckExistUser(int64) (bool, error)

	CreateRequestLinkCode(request models.RequestLinkCode, userID int64) (int64, error)
	AcceptLinkCode(requestID int64) (bool, error)
	AcceptLinkCodeByEmail(requestID int64, code string) (bool, error)
	DeleteRequestLinkCode(requestID int64) (bool, error)
	GetAllRequestsLinkCode(params helpers.ParamsGetAll) ([]models.RequestLinkCode, error)
	CheckExistRequestLinkCode(requestID int64) (bool, error)
}

UserServiceInterface include method list

func NewUserService

func NewUserService() UserServiceInterface

NewUserService to constructor

type ViolationServiceInterface

type ViolationServiceInterface interface {
	GetAll(params helpers.ParamsGetAll) ([]models.Violation, error)
	GetAllOfSupervisior(params helpers.ParamsGetAll, supervisiorCode string) ([]models.Violation, error)
	GetAllOfStudent(params helpers.ParamsGetAll, studentCode string) ([]models.Violation, error)
	//GetAllOfSemester(params helpers.ParamsGetAll, semesterCode string) ([]models.Violation, error)
	Delete(violationID int64) (bool, error)
	Create(violation models.Violation, studentCode string, supervisiorID int64) (int64, error)
	Update(violation models.Violation) (models.Violation, error)
	CheckExistViolation(violationID int64) (bool, error)
	Get(violationID int64) (models.Violation, error)
	CheckPermission(violationID int64, myUserID int64) (bool, error)
	GetSupervisiorID(myUserID int64) (int64, error)
}

ViolationServiceInterface include method list

func NewViolationService

func NewViolationService() ViolationServiceInterface

NewViolationService to constructor

Jump to

Keyboard shortcuts

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