admin: Use gin-gonic as router

This commit is contained in:
nemunaire 2022-05-16 11:38:46 +02:00
commit 8b3fbdb64a
32 changed files with 2748 additions and 1598 deletions

View file

@ -74,6 +74,12 @@ func GetFile(id int64) (f *EFile, err error) {
return
}
func (e *Exercice) GetFile(id int64) (f *EFile, err error) {
f = &EFile{}
err = DBQueryRow("SELECT id_file, origin, path, name, cksum, size FROM exercice_files WHERE id_file = ? AND id_exercice = ?", id, e.Id).Scan(&f.Id, &f.origin, &f.Path, &f.Name, &f.Checksum, &f.Size)
return
}
// GetFileByPath retrieves the file that should be found at the given location.
func GetFileByPath(path string) (*EFile, error) {
path = strings.TrimPrefix(path, FilesDir)