fmt all go file
This commit is contained in:
@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"github.com/leanote/leanote/app/info"
|
||||
// . "github.com/leanote/leanote/app/lea"
|
||||
// . "github.com/leanote/leanote/app/lea"
|
||||
"github.com/leanote/leanote/app/db"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
"time"
|
||||
@ -30,9 +30,9 @@ func (this *AlbumService) GetAlbums(userId string) []info.Album {
|
||||
// delete album
|
||||
// presupposition: has no images under this ablum
|
||||
func (this *AlbumService) DeleteAlbum(userId, albumId string) (bool, string) {
|
||||
if db.Count(db.Files, bson.M{"AlbumId": bson.ObjectIdHex(albumId),
|
||||
if db.Count(db.Files, bson.M{"AlbumId": bson.ObjectIdHex(albumId),
|
||||
"UserId": bson.ObjectIdHex(userId),
|
||||
}) == 0 {
|
||||
}) == 0 {
|
||||
return db.DeleteByIdAndUserId(db.Albums, albumId, userId), ""
|
||||
}
|
||||
return false, "has images"
|
||||
@ -41,4 +41,4 @@ func (this *AlbumService) DeleteAlbum(userId, albumId string) (bool, string) {
|
||||
// update album name
|
||||
func (this *AlbumService) UpdateAlbum(albumId, userId, name string) bool {
|
||||
return db.UpdateByIdAndUserIdField(db.Albums, albumId, userId, "Name", name)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user