Fix error occurring when attaching a file to a Task

Extend the SQL storing the information to a file by username and creation date.
This commit is contained in:
Christian Huff 2016-05-17 09:42:39 +01:00
parent 9b615f894c
commit 632e811b75
1 changed files with 5 additions and 1 deletions

View File

@ -12,7 +12,11 @@ import (
// AddFile is used to add the md5 of a file name which is uploaded to our application
// this will enable us to randomize the URL without worrying about the file names
func AddFile(fileName, token, username string) error {
err := taskQuery("insert into files values(?,?,?,datetime())", fileName, token, username)
userID, err := GetUserID(username)
if err != nil {
return err
}
err = taskQuery("insert into files values(?,?,?,datetime())", fileName, token, userID)
return err
}