New route to display user's traces

This commit is contained in:
nemunaire 2023-03-05 14:20:40 +01:00
commit 084244449c
4 changed files with 34 additions and 0 deletions

View file

@ -670,6 +670,12 @@ func (u *User) getRepository(id int) (r *Repository, err error) {
return
}
func (u *User) getRepositoryByWork(id int64) (r *Repository, err error) {
r = new(Repository)
err = DBQueryRow("SELECT id_repository, id_user, id_work, uri, secret, last_check, droneref, last_tests, testsref FROM user_work_repositories WHERE id_work=? AND id_user=? ORDER BY last_tests DESC LIMIT 1", id, u.Id).Scan(&r.Id, &r.IdUser, &r.IdWork, &r.URI, &r.Secret, &r.LastCheck, &r.DroneRef, &r.LastTests, &r.TestsRef)
return
}
func (u *User) NewRepository(w *Work, uri string) (*Repository, error) {
secret := make([]byte, 24)
_, err := rand.Read(secret)