Minor refactor

This commit is contained in:
Neeraj Gupta
2025-08-25 10:35:47 +05:30
parent 4609c375db
commit f2a26ba391
2 changed files with 7 additions and 12 deletions

View File

@@ -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,

View File

@@ -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(