mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 08:44:04 +01:00
Adds basic documentation for internal packages (#43)
* Added basic documentation wireframe for api, commands, and forms. * Added doc.go
This commit is contained in:
committed by
Michael Mayer
parent
4c20c74e77
commit
00abbf1af5
6
internal/api/doc.go
Normal file
6
internal/api/doc.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
Package api contains REST request handlers used by the server package.
|
||||||
|
|
||||||
|
See https://photoprism.org/ for more information about PhotoPrism.
|
||||||
|
*/
|
||||||
|
package api
|
||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetPhotos searches the databse for photos based on a form.
|
||||||
func GetPhotos(router *gin.RouterGroup, conf *photoprism.Config) {
|
func GetPhotos(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||||
router.GET("/photos", func(c *gin.Context) {
|
router.GET("/photos", func(c *gin.Context) {
|
||||||
var form forms.PhotoSearchForm
|
var form forms.PhotoSearchForm
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var photoIconSvg = []byte(`
|
|||||||
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
|
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
|
||||||
</svg>`)
|
</svg>`)
|
||||||
|
|
||||||
|
// GetThumbnail searches the database for a thumbnail based on hash, size, and type.
|
||||||
func GetThumbnail(router *gin.RouterGroup, conf *photoprism.Config) {
|
func GetThumbnail(router *gin.RouterGroup, conf *photoprism.Config) {
|
||||||
router.GET("/thumbnails/:type/:size/:hash", func(c *gin.Context) {
|
router.GET("/thumbnails/:type/:size/:hash", func(c *gin.Context) {
|
||||||
fileHash := c.Param("hash")
|
fileHash := c.Param("hash")
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ var ConfigCommand = cli.Command{
|
|||||||
Action: configAction,
|
Action: configAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prints current configuration; called by ConfigCommand
|
||||||
func configAction(context *cli.Context) error {
|
func configAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ var ConvertCommand = cli.Command{
|
|||||||
Action: convertAction,
|
Action: convertAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Converts images to JPEG; called by ConvertCommand
|
||||||
func convertAction(context *cli.Context) error {
|
func convertAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
6
internal/commands/doc.go
Normal file
6
internal/commands/doc.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
This package contains commands and flags to be used by the main application.
|
||||||
|
|
||||||
|
See https://photoprism.org/ for more information about PhotoPrism.
|
||||||
|
*/
|
||||||
|
package commands
|
||||||
@@ -35,6 +35,7 @@ var exportFlags = []cli.Flag{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exports photos as JPEG; called by ExportCommand and uses exportFlags
|
||||||
func exportAction(context *cli.Context) error {
|
func exportAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ var ImportCommand = cli.Command{
|
|||||||
Action: importAction,
|
Action: importAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Imports photos from path defined in context arg; called by ImportCommand;
|
||||||
func importAction(context *cli.Context) error {
|
func importAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ var IndexCommand = cli.Command{
|
|||||||
Action: indexAction,
|
Action: indexAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Indexes original photos; called by IndexCommand
|
||||||
func indexAction(context *cli.Context) error {
|
func indexAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ var MigrateCommand = cli.Command{
|
|||||||
Action: migrateAction,
|
Action: migrateAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Automatically migrates / initializes database; called by MigrateCommand
|
||||||
func migrateAction(context *cli.Context) error {
|
func migrateAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var startFlags = []cli.Flag{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Starts web serve using startFlags; called by startCommand
|
||||||
func startAction(context *cli.Context) error {
|
func startAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ var ThumbnailsCommand = cli.Command{
|
|||||||
Action: thumbnailsAction,
|
Action: thumbnailsAction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creates thumbnail; called by ThumbnailsCommand
|
||||||
func thumbnailsAction(context *cli.Context) error {
|
func thumbnailsAction(context *cli.Context) error {
|
||||||
conf := photoprism.NewConfig(context)
|
conf := photoprism.NewConfig(context)
|
||||||
|
|
||||||
|
|||||||
6
internal/forms/doc.go
Normal file
6
internal/forms/doc.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
Package forms contains tagged structs for input value validation.
|
||||||
|
|
||||||
|
See https://photoprism.org/ for more information about PhotoPrism.
|
||||||
|
*/
|
||||||
|
package forms
|
||||||
Reference in New Issue
Block a user