Adding initial scaffolding to rename the repository
Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
parent
c7472582a7
commit
0f880ac1fa
46 changed files with 5707 additions and 674 deletions
55
internal/api/event.go
Normal file
55
internal/api/event.go
Normal file
|
@ -0,0 +1,55 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/photoprism/photoprism/internal/event"
|
||||
"github.com/photoprism/photoprism/internal/form"
|
||||
"github.com/photoprism/photoprism/internal/query"
|
||||
)
|
||||
|
||||
type EntityEvent string
|
||||
|
||||
const (
|
||||
EntityUpdated EntityEvent = "updated"
|
||||
EntityCreated EntityEvent = "created"
|
||||
EntityDeleted EntityEvent = "deleted"
|
||||
)
|
||||
|
||||
func PublishPhotoEvent(e EntityEvent, uid string, c *gin.Context) {
|
||||
f := form.PhotoSearch{ID: uid, Merged: true}
|
||||
result, _, err := query.PhotoSearch(f)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
AbortUnexpected(c)
|
||||
return
|
||||
}
|
||||
|
||||
event.PublishEntities("photos", string(e), result)
|
||||
}
|
||||
|
||||
func PublishAlbumEvent(e EntityEvent, uid string, c *gin.Context) {
|
||||
f := form.AlbumSearch{ID: uid}
|
||||
result, err := query.AlbumSearch(f)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
AbortUnexpected(c)
|
||||
return
|
||||
}
|
||||
|
||||
event.PublishEntities("albums", string(e), result)
|
||||
}
|
||||
|
||||
func PublishLabelEvent(e EntityEvent, uid string, c *gin.Context) {
|
||||
f := form.LabelSearch{ID: uid}
|
||||
result, err := query.Labels(f)
|
||||
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
AbortUnexpected(c)
|
||||
return
|
||||
}
|
||||
|
||||
event.PublishEntities("labels", string(e), result)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue