database

package
v0.0.0-...-f91bbc8 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB : Database holder

Functions

func AddAlbum

func AddAlbum(album models.Album) error

AddAlbum : create album object in db

func AddCollaborator

func AddCollaborator(id bson.ObjectId, collaborator models.Collaborator) error

AddCollaborator : add collaborator to site

func AddModule

func AddModule(site models.Site, module string) error

AddModule : add module to site

func AddTrack

func AddTrack(track models.Track) error

AddTrack : create track object in db

func AddUser

func AddUser(user models.User) (models.User, error)

AddUser inserts user into Database

func AddVideo

func AddVideo(video models.Video) error

AddVideo : add video to db

func AddVideoGroup

func AddVideoGroup(videoGroup models.VideoGroup) error

AddVideoGroup : add video group to db

func Connect

func Connect(server string, database string)

Connect : Connect to MongoDB

func CreateGallery

func CreateGallery(gallery models.Gallery) error

CreateGallery : insert new gallery in db

func CreatePhoto

func CreatePhoto(photo models.Photo) (models.Photo, error)

func CreateSite

func CreateSite(site models.Site) (models.Site, error)

CreateSite : insert site in db

func CreateVerification

func CreateVerification(user models.User) (models.EmailVerification, error)

CreateVerification : insert a verification status in db

func DeleteFile

func DeleteFile(fileID bson.ObjectId, siteID bson.ObjectId) error

DeleteFile : remove file from db

func DeleteGallery

func DeleteGallery(id bson.ObjectId) error

DeleteGallery remove gallery from db

func DeletePhotos

func DeletePhotos(userID bson.ObjectId, ids []bson.ObjectId) error

DeletePhotos : delete multiple photos from db

func DeleteSite

func DeleteSite(site models.Site) error

DeleteSite : complete erase

func DeleteVerification

func DeleteVerification(verification models.EmailVerification) error

DeleteVerification : remove verification from db

func GetAbout

func GetAbout(id bson.ObjectId) (models.AboutContent, error)

GetAbout : return about content of site

func GetAlbum

func GetAlbum(ID bson.ObjectId) (models.Album, error)

GetAlbum : return specific album by ObjectID

func GetAlbumByShortID

func GetAlbumByShortID(id string) (models.Album, error)

GetAlbumByShortID : return specific album by short_id

func GetAlbumTracks

func GetAlbumTracks(id bson.ObjectId) ([]models.Track, error)

GetAlbumTracks : return array of track for specific album

func GetAlbums

func GetAlbums(siteID bson.ObjectId) ([]models.Album, error)

GetAlbums : return array of album for specific site

func GetArticle

func GetArticle(id bson.ObjectId) (models.Article, error)

GetArticle : return single article based by short_id

func GetArticleByShortID

func GetArticleByShortID(shortID string) (models.Article, error)

GetArticle : return single article based by short_id

func GetArticles

func GetArticles(id bson.ObjectId) ([]models.Article, error)

GetArticles : return array of articles of site

func GetContact

func GetContact(id bson.ObjectId) (models.ContactContent, error)

GetContact : return contact content

func GetDefaultGallery

func GetDefaultGallery(id bson.ObjectId) (models.Gallery, error)

GetDefaultGallery return default gallery

func GetGalleries

func GetGalleries(id bson.ObjectId) ([]models.Gallery, error)

GetGalleries return site's galleries

func GetGallery

func GetGallery(id bson.ObjectId) (models.Gallery, error)

GetGallery return specific gallery

func GetGalleryByShortID

func GetGalleryByShortID(shortID string) (models.Gallery, error)

GetGallery return specific gallery

func GetGalleryPhotos

func GetGalleryPhotos(id bson.ObjectId) ([]models.Photo, error)

GetGalleryPhotos return photos of gallery

func GetGroupVideos

func GetGroupVideos(id bson.ObjectId) ([]models.Video, error)

GetGroupVideos : return array of video from a videogroup

func GetOwnedSites

func GetOwnedSites(id bson.ObjectId) ([]models.Site, error)

GetOwnedSites : return only owned sites (and not the ones you might collaborate with)

func GetPhotoByID

func GetPhotoByID(id bson.ObjectId) (models.Photo, error)

func GetPhotos

func GetPhotos(userID bson.ObjectId, ids []bson.ObjectId) ([]models.Photo, error)

GetPhotos : return array of photos

func GetProject

func GetProject(id bson.ObjectId) (models.Project, error)

GetProject : return project using shortid

func GetProjectByShortID

func GetProjectByShortID(shortID string) (models.Project, error)

GetProject : return project using shortid

func GetProjects

func GetProjects(id bson.ObjectId) ([]models.Project, error)

GetProjects : return projects of site

func GetSiteByID

func GetSiteByID(id bson.ObjectId) (models.Site, error)

GetSiteByID : return specific site by ObjectID

func GetSiteByName

func GetSiteByName(name string) (models.Site, error)

GetSiteByName : return specific site

func GetSiteFiles

func GetSiteFiles(id bson.ObjectId) ([]models.File, error)

GetSiteFiles : return array of file for site

func GetSitePhotos

func GetSitePhotos(id bson.ObjectId) ([]models.Photo, error)

GetSitePhotos : return photos from site

func GetSiteTotalSize

func GetSiteTotalSize(siteID bson.ObjectId) float64

GetSiteTotalSize : return site size in MB

func GetSitesOfUser

func GetSitesOfUser(user models.User) ([]models.Site, error)

GetSitesOfUser : return array of Site of specific user

func GetTrack

func GetTrack(trackID bson.ObjectId) (models.Track, error)

GetTrack : return specific track by ObjectID

func GetTrackByShortID

func GetTrackByShortID(shortID string) (models.Track, error)

GetTrack : return specific track by shortID

func GetUser

func GetUser(email string) (models.User, error)

GetUser get user by username or email

func GetUserByEmail

func GetUserByEmail(email string) (models.User, error)

GetUserByEmail : return user by email

func GetUserByID

func GetUserByID(id bson.ObjectId) (models.User, error)

GetUserByID : returns user object with id

func GetVerificationByID

func GetVerificationByID(id bson.ObjectId) (models.EmailVerification, error)

GetVerificationByID : get email verification by id

func GetVideo

func GetVideo(videoID bson.ObjectId) (models.Video, error)

GetVideo : Return specific video by ObjectID

func GetVideoGroup

func GetVideoGroup(ID bson.ObjectId) (models.VideoGroup, error)

GetVideoGroup : return specific video group by ObjectID

func GetVideoGroupByShortID

func GetVideoGroupByShortID(id string) (models.VideoGroup, error)

GetVideoGroupByShortID : return specific video group by short_id

func GetVideoGroups

func GetVideoGroups(siteID bson.ObjectId) ([]models.VideoGroup, error)

GetVideoGroups : Return array of videogroup from site

func InsertEmailVerification

func InsertEmailVerification(verification models.EmailVerification) error

InsertEmailVerification insert email verification object in db

func InsertFile

func InsertFile(file models.File) error

InsertFile : create file in db

func InsertPhoto

func InsertPhoto(photo models.Photo) (models.Photo, error)

InsertPhoto : insert photo in db

func IsEmailRegistered

func IsEmailRegistered(email string) bool

IsEmailRegistered checks if email already exists in db

func RemoveAlbum

func RemoveAlbum(id bson.ObjectId) error

RemoveAlbum : delete album object from db

func RemoveArticle

func RemoveArticle(id bson.ObjectId) error

RemoveArticle : remove article from db

func RemoveCollaborator

func RemoveCollaborator(id bson.ObjectId, email string) error

RemoveCollaborator : remove collaborator from site

func RemoveModule

func RemoveModule(site models.Site, module string) error

RemoveModule : remove module from site

func RemoveProject

func RemoveProject(id bson.ObjectId) error

RemoveProject : remove project from db

func RemoveTrack

func RemoveTrack(id bson.ObjectId) error

RemoveTrack : delete track from db

func RemoveUser

func RemoveUser(id bson.ObjectId) error

RemoveUser : remove user from db

func RemoveUserSubscription

func RemoveUserSubscription(user models.User) error

RemoveUserSubscription : remove pro subscription from user

func RemoveVideo

func RemoveVideo(id bson.ObjectId) error

RemoveVideo : remove video from db

func RemoveVideoGroup

func RemoveVideoGroup(id bson.ObjectId) error

RemoveVideoGroup : remove video group from db

func SetDefaultGallery

func SetDefaultGallery(site models.Site, gallery models.Gallery) error

SetDefaultGallery : set a default gallery (useful for a homepage gallery for example)

func SetGalleryPreview

func SetGalleryPreview(gallery models.Gallery, photo models.Photo) error

SetGalleryPreview : set a gallery preview image

func SetSiteFavorite

func SetSiteFavorite(user models.User, siteID bson.ObjectId) error

SetSiteFavorite : set site favorite

func SetUserPro

func SetUserPro(id bson.ObjectId, customer *stripe.Customer, subscription *stripe.Subscription) error

SetUserPro : add pro subscription to user

func SiteExists

func SiteExists(name string) bool

SiteExists : check if site exists

func TransferSite

func TransferSite(site models.Site, lastOwner models.User, newOwner models.User) error

TransferSite : Transfer the site to another user

func UpdateAbout

func UpdateAbout(id bson.ObjectId, about models.AboutContent) error

UpdateAbout : update about content of site

func UpdateAlbum

func UpdateAlbum(id bson.ObjectId, album models.Album) error

UpdateAlbum : update album (title, cover, description)

func UpdateAlbumsIndexes

func UpdateAlbumsIndexes(siteID bson.ObjectId, albums []models.Album) error

UpdateAlbumsIndexes : change order of albums

func UpdateContact

func UpdateContact(id bson.ObjectId, content models.ContactContent) error

UpdateContact : update contact content

func UpdateFilename

func UpdateFilename(fileID bson.ObjectId, filename string, siteID bson.ObjectId) error

UpdateFilename : change the name of a file

func UpdateGalleriesIndexes

func UpdateGalleriesIndexes(siteID bson.ObjectId, galleries []models.Gallery) error

UpdateGalleriesIndexes : Update galleries order

func UpdateGallery

func UpdateGallery(id bson.ObjectId, gallery models.Gallery) error

UpdateGallery update gallery

func UpdatePhoto

func UpdatePhoto(id bson.ObjectId, photo models.Photo) error

UpdatePhoto updates title & content

func UpdatePhotoURL

func UpdatePhotoURL(id bson.ObjectId, url string) error

func UpdatePhotosIndexes

func UpdatePhotosIndexes(gallery models.Gallery, photos []models.Photo) error

UpdatePhotosIndexes : update order of photos

func UpdateSite

func UpdateSite(id bson.ObjectId, data models.Site) error

UpdateSite : update site data

func UpdateTrack

func UpdateTrack(id bson.ObjectId, track models.Track) error

UpdateTrack : update track informations (title, url, image)

func UpdateTracksIndexes

func UpdateTracksIndexes(siteID bson.ObjectId, tracks []models.Track) error

UpdateTracksIndexes : update order of tracks

func UpdateUser

func UpdateUser(user models.User, updateUser models.User) (models.User, error)

UpdateUser : update user data

func UpdateUserPassword

func UpdateUserPassword(id bson.ObjectId, password string) error

UpdateUserPassword : update user password, password is of course hashed

func UpdateVideo

func UpdateVideo(id bson.ObjectId, video models.Video) error

Updatevideo : update video informations (title, content, youtube_url)

func UpdateVideoGroup

func UpdateVideoGroup(id bson.ObjectId, group models.VideoGroup) error

UpdateVideoGroup : update video group informations (title, image)

func UpdateVideoGroupsIndexes

func UpdateVideoGroupsIndexes(siteID bson.ObjectId, groups []models.VideoGroup) error

UpdateVideoGroupsIndexes : Update order of video groups

func UpdateVideosIndexes

func UpdateVideosIndexes(siteID bson.ObjectId, videos []models.Video) error

UpdateVideosIndexes : update order of videos

func UpsertArticle

func UpsertArticle(article models.Article) (models.Article, error)

UpsertArticle : create/update article

func UpsertProject

func UpsertProject(project models.Project) error

UpsertProject Update or insert project

func VerifyEmail

func VerifyEmail(email string, r *http.Request) (bool, string)

VerifyEmail : check email format and whether it's been assigned already or not

func VerifyUser

func VerifyUser(user models.User, verification models.EmailVerification) error

VerifyUser : verify user

Types

This section is empty.

Jump to

Keyboard shortcuts

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