service

package
v0.0.0-...-2b71c33 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrivateProfileFields = []string{"user_id", "username", "full_name", "description", "status", "bean", "password", "google_id"}
View Source
var PublicProfileFields = []string{"user_id", "username", "description", "status", "bean"}

Functions

func AddFollow

func AddFollow(follower_id int64, followee_id int64) error

func AddGoogleUser

func AddGoogleUser(google_id string, username string, full_name string, email string) (*model.User, error)

func AddNote

func AddNote(user_id int64, title string, description string, is_template bool, course_id *int64, bean int) (*model.Note, error)

func AddNoteTag

func AddNoteTag(user_id int64, note_id int64, tag_id int64) error

func AddTag

func AddTag(tag_name string) (*model.Tag, error)

func AddUser

func AddUser(username string, full_name string, email string, password string) (*model.User, error)

func BeanTransaction

func BeanTransaction(seller_id int64, buyer_id int64, bean int64) error

func BuyNote

func BuyNote(user_id int64, note_id int64) (*model.Note, error)

func CheckUserBuyNote

func CheckUserBuyNote(user_id int64, note_id int64) bool

func DeleteFollow

func DeleteFollow(follower_id int64, followee_id int64) error

func DeleteNote

func DeleteNote(user_id int64, note_id int64) error

func DeleteNoteTag

func DeleteNoteTag(user_id int64, note_id int64, tag_id int64) error

func DeleteSave

func DeleteSave(user_id int64, note_id int64) error

func EditNote

func EditNote(user_id int64, note_id int64, form EditNoteInput) error

func EditPassword

func EditPassword(account_id int64, form EditPasswordInput) error

func EditProfile

func EditProfile(account_id int64, form EditAccountInput) error

func FindCourse

func FindCourse(course_id int64) (*model.Course, error)

func FindPrivateProfile

func FindPrivateProfile(account_id int64) (*model.User, int64, int64, int64, error)

func FindPublicProfile

func FindPublicProfile(account_id int64) (*model.User, int64, int64, int64, error)

func FindSales

func FindSales(note_id int64) (int64, int64, error)

func FindSchool

func FindSchool(school_id int64) (*model.School, error)

func FindSchoolCourse

func FindSchoolCourse(school_id int64) ([]*model.Course, error)

func FindSchools

func FindSchools() ([]*model.School, error)

func FindTag

func FindTag(tag_id int64) (*model.Tag, error)

func FindTags

func FindTags() ([]*model.Tag, error)

func Fitz

func Fitz(filepath string, file multipart.File) error

func GetFollow

func GetFollow(follower_id int64, followee_id int64) (bool, error)

func GetMyNote

func GetMyNote(user_id int64, note_id int64) (bool, error)

func GetNoteById

func GetNoteById(note_id int64) (*model.Note, error)

func GetNoteByIdWithCourse

func GetNoteByIdWithCourse(note_id int64) (*model.Note, error)

func GetNoteSavedCnt

func GetNoteSavedCnt(note_id int64) (int64, error)

func GetNoteTag

func GetNoteTag(note_id int64) (*[]model.NoteTag, error)

func GetNotes

func GetNotes(filter string, offset int64) ([]model.Note, int64, error)

func GetNotesByCourse

func GetNotesByCourse(course_id int64, filter string, offset int64) ([]model.Note, int64, error)

string type: all-popular, notability-popular, goodnotes-popular, all-recent, notability-recent, goodnotes-recent

func GetNotesByUserId

func GetNotesByUserId(user_id int64, filter string, offset int64) ([]model.Note, int64, error)

string type: all-popular, notability-popular, goodnotes-popular, all-recent, notability-recent, goodnotes-recent

func GetOwnLibraryNotes

func GetOwnLibraryNotes(user_id int64, filter string, offset int64) ([]model.Download, int64, error)

uploaded/saved/library string type: all, notability, goodnotes

func GetOwnSavedNotes

func GetOwnSavedNotes(user_id int64, filter string, offset int64) ([]model.Saved, int64, error)

uploaded/saved/library string type: all, notability, goodnotes

func GetOwnUploadedNotes

func GetOwnUploadedNotes(user_id int64, filter string, offset int64) ([]model.Note, int64, error)

uploaded/saved/library string type: all, notability, goodnotes

func GetSave

func GetSave(user_id int64, note_id int64) (bool, error)

func GetTagsByBatch

func GetTagsByBatch(tagIds *[]int64) (*[]model.Tag, error)

func GetUserNameByUserId

func GetUserNameByUserId(user_id int64) (string, error)

func GetUserNoteById

func GetUserNoteById(user_id int64, note_id int64) (*model.Note, error)

func SaveNote

func SaveNote(user_id int64, note_id int64) error

func SavedNote

func SavedNote(user_id int64, note_id int64) (bool, error)

func SignedFileUrl

func SignedFileUrl(filePath string) (string, error)

func UpdateGoodnotesFilename

func UpdateGoodnotesFilename(note_id int64, filename string) error

func UpdateNotabilityFilename

func UpdateNotabilityFilename(note_id int64, filename string) error

func UpdateNoteViewCnt

func UpdateNoteViewCnt(note_id int64, view_cnt int64) error

func UpdatePdfFilename

func UpdatePdfFilename(note_id int64, pdf_filename string, preview_filename string) error

func UpdatePreviewFilename

func UpdatePreviewFilename(note_id int64, preview_filename string) error

func UploadFile

func UploadFile(filePath string, file multipart.File) error

func UploadImg

func UploadImg(filePath string, img io.Reader) error

func VerifyGoogleLogin

func VerifyGoogleLogin(google_id string) (*model.User, error)

func VerifyIdToken

func VerifyIdToken(idToken string) (*oauth2.Tokeninfo, error)

func VerifyLogin

func VerifyLogin(username string, password string) (*model.User, error)

Types

type EditAccountInput

type EditAccountInput struct {
	Username    string `json:"username"`
	Full_name   string `json:"full_name"`
	Email       string `json:"email"`
	Description string `json:"description"`
}

type EditNoteInput

type EditNoteInput struct {
	Title       string `json:"title" binding:"required"`
	Description string `json:"description" binding:"required"`
	Course_id   *int64 `json:"course_id"`
	Bean        *int   `json:"bean" binding:"required"`
	Is_template *bool  `json:"is_template" binding:"required"`
}

type EditPasswordInput

type EditPasswordInput struct {
	Old_password string `json:"old_password"`
	New_password string `json:"new_password" binding:"required"`
}

type Follow_Member_Detail

type Follow_Member_Detail struct {
	Account_id int64  `json:"account_id"`
	Username   string `json:"username"`
	Full_name  string `json:"full_name"`
}

func GetFollowers

func GetFollowers(followee_id int64) ([]*Follow_Member_Detail, error)

func GetFollowing

func GetFollowing(follower_id int64) ([]*Follow_Member_Detail, error)

type NoteOutput

type NoteOutput struct {
	Note_ID             int64     `json:"note_id"`
	ID                  int64     `json:"user_id"`
	Username            string    `json:"username"`
	Title               string    `json:"title"`
	Preview_filename    string    `json:"preview_filename"`
	Goodnotes_filename  string    `json:"goodnotes_filename"`
	Notability_filename string    `json:"notability_filename"`
	View_cnt            int64     `json:"view_cnt"`
	CreatedAt           time.Time `json:"created_at"`
}

func GetNotesByTag

func GetNotesByTag(tag_id int64, filter string, offset int64) ([]NoteOutput, int64, error)

string type: all-popular, notability-popular, goodnotes-popular, all-recent, notability-recent, goodnotes-recent

type SearchCourseOutput

type SearchCourseOutput struct {
	ID                int64     `json:"course_id"`
	Course_no         string    `json:"course_no"`
	Course_name       string    `json:"course_name"`
	School_name       string    `json:"school_name"`
	School_ID         int64     `json:"school_id"`
	Note_cnt          int64     `json:"note_cnt"`
	Last_updated_time time.Time `json:"last_updated_time"`
}

func SearchCourse

func SearchCourse(q string, offset int, limit int) ([]*SearchCourseOutput, int64, error)

type SearchNoteOutput

type SearchNoteOutput struct {
	ID                  int64     `json:"note_id"`
	User_id             int64     `json:"user_id"`
	Username            string    `json:"username"`
	Title               string    `json:"title"`
	View_cnt            int64     `json:"view_cnt"`
	Preview_filename    string    `json:"preview_filename"`
	Goodnotes_filename  string    `json:"goodnotes_filename"`
	Notability_filename string    `json:"notability_filename"`
	CreatedAt           time.Time `json:"created_at"`
}

func SearchNote

func SearchNote(q string, offset int, limit int, note_type string) ([]SearchNoteOutput, int64, error)

LIKE: title note_type: all, notability, goodnotes

func SearchTemplate

func SearchTemplate(q string, offset int, limit int, note_type string) ([]SearchNoteOutput, int64, error)

LIKE: title note_type: all, notability, goodnotes

type SearchSchoolOutput

type SearchSchoolOutput struct {
	ID          int64  `json:"school_id"`
	School_name string `json:"school_name"`
}

func SearchSchool

func SearchSchool(q string, offset int, limit int) ([]SearchSchoolOutput, int64, error)

type SearchTagOutput

type SearchTagOutput struct {
	ID       int64  `json:"tag_id"`
	Tag_name string `json:"tag_name"`
}

func SearchTag

func SearchTag(q string, offset int, limit int) ([]SearchTagOutput, int64, error)

type SearchUserOutput

type SearchUserOutput struct {
	ID       int64  `json:"user_id"`
	Username string `json:"username"`
}

func SearchUser

func SearchUser(q string, offset int, limit int) ([]SearchUserOutput, int64, error)

Jump to

Keyboard shortcuts

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