GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
593 B

package files
import (
"time"
"git.aiterp.net/rpdata/api/models"
)
// Insert manually inserts file information into the database. This should never, ever be HTTP API accessible
func Insert(name, kind, mimeType, author string, time time.Time, size int64, url string) (models.File, error) {
file := models.File{
ID: makeID(),
Kind: kind,
Time: time,
Public: false,
Author: author,
Name: name,
MimeType: mimeType,
Size: size,
URL: url,
}
err := collection.Insert(file)
if err != nil {
return models.File{}, err
}
return file, nil
}