Minor refactor
This commit is contained in:
@@ -139,12 +139,8 @@ func (c *FileLinkController) ValidateJWTToken(ctx *gin.Context, jwtToken string,
|
||||
|
||||
func (c *FileLinkController) mapRowToFileUrl(ctx *gin.Context, row *ente.FileLinkRow) *ente.FileUrl {
|
||||
app := auth.GetApp(ctx)
|
||||
var url string
|
||||
if app == ente.Locker {
|
||||
url = c.FileLinkRepo.LockerFileLink(row.Token)
|
||||
} else {
|
||||
url = c.FileLinkRepo.PhotoLink(row.Token)
|
||||
}
|
||||
url := c.FileLinkRepo.FileLink(app, row.Token)
|
||||
|
||||
return &ente.FileUrl{
|
||||
LinkID: row.LinkID,
|
||||
FileID: row.FileID,
|
||||
|
||||
@@ -38,12 +38,11 @@ func NewFileLinkRepo(db *sql.DB) *FileLinkRepository {
|
||||
}
|
||||
}
|
||||
|
||||
func (pcr *FileLinkRepository) PhotoLink(token string) string {
|
||||
return fmt.Sprintf("%s/?t=%s", pcr.photoHost, token)
|
||||
}
|
||||
|
||||
func (pcr *FileLinkRepository) LockerFileLink(token string) string {
|
||||
return fmt.Sprintf("%s/?t=%s", pcr.lockerHost, token)
|
||||
func (pcr *FileLinkRepository) FileLink(app ente.App, token string) string {
|
||||
if app == ente.Locker {
|
||||
return fmt.Sprintf("%s/file/?t=%s", pcr.lockerHost, token)
|
||||
}
|
||||
return fmt.Sprintf("%s/file/?t=%s", pcr.photoHost, token)
|
||||
}
|
||||
|
||||
func (pcr *FileLinkRepository) Insert(
|
||||
|
||||
Reference in New Issue
Block a user