admin: display file dependancies and be able to remove them
This commit is contained in:
parent
c8ece39cb2
commit
8131fda0e7
5 changed files with 93 additions and 3 deletions
|
@ -300,6 +300,16 @@ func (f EFile) AddDepend(j Flag) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// DeleteDepend insert a new dependency to a given flag.
|
||||
func (f EFile) DeleteDepend(j Flag) (err error) {
|
||||
if k, ok := j.(FlagKey); ok {
|
||||
_, err = DBExec("DELETE FROM exercice_files_deps WHERE id_file = ? AND id_flag = ?", f.Id, k.Id)
|
||||
} else {
|
||||
err = errors.New("Dependancy type not implemented for this file.")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetDepends retrieve the flag's dependency list.
|
||||
func (f EFile) GetDepends() ([]Flag, error) {
|
||||
if rows, err := DBQuery("SELECT id_flag FROM exercice_files_deps WHERE id_file = ?", f.Id); err != nil {
|
||||
|
|
Reference in a new issue