Commit f2347cab authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

clean up

parent 6c9459e6
...@@ -51,13 +51,12 @@ func AllShares(w http.ResponseWriter, _ *http.Request) *HTTPError { ...@@ -51,13 +51,12 @@ func AllShares(w http.ResponseWriter, _ *http.Request) *HTTPError {
return SendJSON(w, shares) return SendJSON(w, shares)
} }
func GetShare(w http.ResponseWriter, r *http.Request) *HTTPError { func GetShare(w http.ResponseWriter, r *http.Request) *HTTPError {
fmt.Println("Get Share") fmt.Println("Get Share")
vars := mux.Vars(r) vars := mux.Vars(r)
shareID, err := uuid.Parse(vars["id"]) shareID, err := uuid.Parse(vars["id"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
db, err := GetDatabase() db, err := GetDatabase()
...@@ -91,18 +90,17 @@ func GetShare(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -91,18 +90,17 @@ func GetShare(w http.ResponseWriter, r *http.Request) *HTTPError {
return SendJSON(w, share) return SendJSON(w, share)
} }
func DownloadFile(w http.ResponseWriter, r *http.Request) *HTTPError { func DownloadFile(w http.ResponseWriter, r *http.Request) *HTTPError {
fmt.Println("Download file") fmt.Println("Download file")
vars := mux.Vars(r) vars := mux.Vars(r)
shareID, err := uuid.Parse(vars["id"]) shareID, err := uuid.Parse(vars["id"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
attID, err := uuid.Parse(vars["att"]) attID, err := uuid.Parse(vars["att"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
db, err := GetDatabase() db, err := GetDatabase()
...@@ -144,7 +142,6 @@ func DownloadFile(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -144,7 +142,6 @@ func DownloadFile(w http.ResponseWriter, r *http.Request) *HTTPError {
return nil return nil
} }
func OpenShare(w http.ResponseWriter, r *http.Request) *HTTPError { func OpenShare(w http.ResponseWriter, r *http.Request) *HTTPError {
fmt.Println("OpenShare") fmt.Println("OpenShare")
...@@ -175,14 +172,13 @@ func OpenShare(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -175,14 +172,13 @@ func OpenShare(w http.ResponseWriter, r *http.Request) *HTTPError {
return SendJSON(w, newShare) return SendJSON(w, newShare)
} }
func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError { func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError {
fmt.Println("CloseShare") fmt.Println("CloseShare")
vars := mux.Vars(r) vars := mux.Vars(r)
shareID, err := uuid.Parse(vars["id"]) shareID, err := uuid.Parse(vars["id"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
db, err := GetDatabase() db, err := GetDatabase()
...@@ -224,7 +220,7 @@ func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -224,7 +220,7 @@ func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError {
// "ShareID": share.ID, // "ShareID": share.ID,
//}) //})
if err != nil { if err != nil {
return &HTTPError{ err, "Error creating background job", 500 } return &HTTPError{err, "Error creating background job", 500}
} }
PrettyPrint(job) PrettyPrint(job)
} }
...@@ -232,14 +228,13 @@ func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -232,14 +228,13 @@ func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError {
return SendJSON(w, share) return SendJSON(w, share)
} }
func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError { func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError {
fmt.Println("UploadTest") fmt.Println("UploadTest")
vars := mux.Vars(r) vars := mux.Vars(r)
shareID, err := uuid.Parse(vars["id"]) shareID, err := uuid.Parse(vars["id"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
db, err := GetDatabase() db, err := GetDatabase()
...@@ -257,11 +252,11 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -257,11 +252,11 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError {
return &HTTPError{err, "Can't fetch data", 500} return &HTTPError{err, "Can't fetch data", 500}
} }
if share.IsTemporary != true { if share.IsTemporary != true {
return &HTTPError{ errors.New("share is not finalized"), "Can't upload to finalized Shares.", 403 } return &HTTPError{errors.New("share is not finalized"), "Can't upload to finalized Shares.", 403}
} }
// Parse file from body // Parse file from body
err = r.ParseMultipartForm(config.chunkSize) // Maximum 10 MB in RAM err = r.ParseMultipartForm(config.chunkSize) // Maximum 10 MB in RAM
if err != nil { if err != nil {
return &HTTPError{err, "Request does not contain a valid body (parsing form)", 400} return &HTTPError{err, "Request does not contain a valid body (parsing form)", 400}
} }
...@@ -277,7 +272,7 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -277,7 +272,7 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError {
db.Begin() db.Begin()
sid, err := uuid.Parse(shareID.String()) sid, err := uuid.Parse(shareID.String())
if err != nil { if err != nil {
return &HTTPError{ err, "foreign key shareID not valid", 500 } return &HTTPError{err, "foreign key shareID not valid", 500}
} }
att.ShareID = sid att.ShareID = sid
att.Filename = handler.Filename att.Filename = handler.Filename
...@@ -287,12 +282,12 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -287,12 +282,12 @@ func UploadAttachment(w http.ResponseWriter, r *http.Request) *HTTPError {
// save file // save file
fileBytes, err := ioutil.ReadAll(file) fileBytes, err := ioutil.ReadAll(file)
if err != nil { if err != nil {
return &HTTPError{ err, "cant read file", 500 } return &HTTPError{err, "cant read file", 500}
} }
err = ioutil.WriteFile(filepath.Join(config.mediaDir, "temp", sid.String(), att.ID.String()), fileBytes, os.ModePerm) err = ioutil.WriteFile(filepath.Join(config.mediaDir, "temp", sid.String(), att.ID.String()), fileBytes, os.ModePerm)
if err != nil { if err != nil {
db.Rollback() db.Rollback()
return &HTTPError{ err, "cant save file", 500 } return &HTTPError{err, "cant save file", 500}
} }
db.Commit() db.Commit()
} }
...@@ -306,7 +301,7 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -306,7 +301,7 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
vars := mux.Vars(r) vars := mux.Vars(r)
shareID, err := uuid.Parse(vars["id"]) shareID, err := uuid.Parse(vars["id"])
if err != nil { if err != nil {
return &HTTPError{ err, "invalid URL param", 400 } return &HTTPError{err, "invalid URL param", 400}
} }
share, er := RetrieveShare(shareID, true) share, er := RetrieveShare(shareID, true)
...@@ -320,17 +315,17 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -320,17 +315,17 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
fileToZip, err := os.Open(filePath) fileToZip, err := os.Open(filePath)
if err != nil { if err != nil {
return &HTTPError{ err, "error opening file", 500} return &HTTPError{err, "error opening file", 500}
} }
info, err := fileToZip.Stat() info, err := fileToZip.Stat()
if err != nil { if err != nil {
return &HTTPError{ err, "error getting file info", 500 } return &HTTPError{err, "error getting file info", 500}
} }
header, err := zip.FileInfoHeader(info) header, err := zip.FileInfoHeader(info)
if err != nil { if err != nil {
return &HTTPError{ err, "error creating file header", 500 } return &HTTPError{err, "error creating file header", 500}
} }
header.Name = file.Filename header.Name = file.Filename
...@@ -338,19 +333,19 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError { ...@@ -338,19 +333,19 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
writer, err := zipWriter.CreateHeader(header) writer, err := zipWriter.CreateHeader(header)
if err != nil { if err != nil {
return &HTTPError{ err, "error creating header", 500 } return &HTTPError{err, "error creating header", 500}
} }
if _, err := io.Copy(writer, fileToZip); err != nil{ if _, err := io.Copy(writer, fileToZip); err != nil {
return &HTTPError{ err, "error copying file into zip archive", 500 } return &HTTPError{err, "error copying file into zip archive", 500}
} }
if err := fileToZip.Close(); err != nil { if err := fileToZip.Close(); err != nil {
return &HTTPError{ err, "error closing zip archive", 500 } return &HTTPError{err, "error closing zip archive", 500}
} }
} }
err = zipWriter.Close() err = zipWriter.Close()
if err != nil { if err != nil {
return &HTTPError{ err, "error when closing zip", 500 } return &HTTPError{err, "error when closing zip", 500}
} }
return nil return nil
...@@ -368,7 +363,7 @@ func RetrieveShare(shareID uuid.UUID, withAtt bool) (*Share, *HTTPError) { ...@@ -368,7 +363,7 @@ func RetrieveShare(shareID uuid.UUID, withAtt bool) (*Share, *HTTPError) {
var share Share var share Share
if withAtt == true { if withAtt == true {
err = db.Preload("Attachments").Where("ID = ?", shareID).First(&share).Error err = db.Preload("Attachments").Where("ID = ?", shareID).First(&share).Error
}else { } else {
err = db.Where("ID = ?", shareID).First(&share).Error err = db.Where("ID = ?", shareID).First(&share).Error
} }
......
...@@ -20,40 +20,40 @@ import ( ...@@ -20,40 +20,40 @@ import (
) )
// DATA // DATA
var shares = []Share { var shares = []Share{
{ {
ID: uuid.MustParse("5713d228-a042-446d-a5e4-183b19fa832a"), ID: uuid.MustParse("5713d228-a042-446d-a5e4-183b19fa832a"),
Name: "TestFinalPrivate", Name: "TestFinalPrivate",
DownloadLimit: 100, DownloadLimit: 100,
IsPublic: false, IsPublic: false,
IsTemporary: false, IsTemporary: false,
Password: "test123", Password: "test123",
Emails:[]string{""}, Emails: []string{""},
Attachments: []Attachment { Attachments: []Attachment{
{ {
ID: uuid.MustParse("913134c0-894f-4c4d-b545-92ec373168b1"), ID: uuid.MustParse("913134c0-894f-4c4d-b545-92ec373168b1"),
Filename: "kekw.txt", Filename: "kekw.txt",
Filesize: 123456, Filesize: 123456,
IsEncrypted: false, IsEncrypted: false,
ShareID: uuid.MustParse("5713d228-a042-446d-a5e4-183b19fa832a"), ShareID: uuid.MustParse("5713d228-a042-446d-a5e4-183b19fa832a"),
}, },
}, },
}, },
{ {
ID: uuid.MustParse("f43b0e48-13cc-4c6c-8a23-3a18a670effd"), ID: uuid.MustParse("f43b0e48-13cc-4c6c-8a23-3a18a670effd"),
Name: "TestFinalPublic", Name: "TestFinalPublic",
IsPublic: true, IsPublic: true,
IsTemporary: false, IsTemporary: false,
Emails:[]string{""}, Emails: []string{""},
}, },
{ {
ID: uuid.MustParse("a558aca3-fb40-400b-8dc6-ae49c705c791"), ID: uuid.MustParse("a558aca3-fb40-400b-8dc6-ae49c705c791"),
Name: "TestTemporary", Name: "TestTemporary",
DownloadLimit: 300, DownloadLimit: 300,
IsPublic: true, IsPublic: true,
IsTemporary: true, IsTemporary: true,
Emails:[]string{""}, Emails: []string{""},
}, },
} }
...@@ -108,7 +108,7 @@ func TestGetShare(t *testing.T) { ...@@ -108,7 +108,7 @@ func TestGetShare(t *testing.T) {
t.Run("happy path", func(t *testing.T) { t.Run("happy path", func(t *testing.T) {
header := map[string][]string{ header := map[string][]string{
"Authorization": { "Basic NTcxM2QyMjgtYTA0Mi00NDZkLWE1ZTQtMTgzYjE5ZmE4MzJhOnRlc3QxMjM=" }, // pw: test123 "Authorization": {"Basic NTcxM2QyMjgtYTA0Mi00NDZkLWE1ZTQtMTgzYjE5ZmE4MzJhOnRlc3QxMjM="}, // pw: test123
} }
req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s", ts.URL, shares[0].ID.String()), nil) req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s", ts.URL, shares[0].ID.String()), nil)
req.Header = header req.Header = header
...@@ -155,22 +155,22 @@ func TestDownloadFile(t *testing.T) { ...@@ -155,22 +155,22 @@ func TestDownloadFile(t *testing.T) {
t.Run("happy path", func(t *testing.T) { t.Run("happy path", func(t *testing.T) {
req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), shares[0].Attachments[0].ID.String()), nil) req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), shares[0].Attachments[0].ID.String()), nil)
req.Header = map[string][]string{ req.Header = map[string][]string{
"Authorization": { "Basic NTcxM2QyMjgtYTA0Mi00NDZkLWE1ZTQtMTgzYjE5ZmE4MzJhOnRlc3QxMjM=" }, // pw: test123 "Authorization": {"Basic NTcxM2QyMjgtYTA0Mi00NDZkLWE1ZTQtMTgzYjE5ZmE4MzJhOnRlc3QxMjM="}, // pw: test123
} }
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
body, _ := ioutil.ReadAll(res.Body) body, _ := ioutil.ReadAll(res.Body)
assert.FileExists(t, filepath.Join(config.mediaDir, "data", shares[0].ID.String(), shares[0].Attachments[0].ID.String())) assert.FileExists(t, filepath.Join(config.mediaDir, "data", shares[0].ID.String(), shares[0].Attachments[0].ID.String()))
expected, _ := ioutil.ReadFile(filepath.Join(config.mediaDir, "data", shares[0].ID.String(), shares[0].Attachments[0].ID.String())) expected, _ := ioutil.ReadFile(filepath.Join(config.mediaDir, "data", shares[0].ID.String(), shares[0].Attachments[0].ID.String()))
assert.EqualValues(t, expected ,body) assert.EqualValues(t, expected, body)
assert.EqualValues(t, http.StatusOK, res.StatusCode) assert.EqualValues(t, http.StatusOK, res.StatusCode)
}) })
t.Run("unauthorized", func(t *testing.T) { t.Run("unauthorized", func(t *testing.T) {
req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), shares[0].Attachments[0].ID.String()), nil) req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), shares[0].Attachments[0].ID.String()), nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
assert.EqualValues(t, http.StatusUnauthorized, res.StatusCode) assert.EqualValues(t, http.StatusUnauthorized, res.StatusCode)
}) })
t.Run("not found", func(t *testing.T) { t.Run("not found", func(t *testing.T) {
req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), "0dd9a011-612b-4f33-99c0-bfd687021014"), nil) req, _ := http.NewRequest("GET", fmt.Sprintf("%s/share/%s/attachment/%s", ts.URL, shares[0].ID.String(), "0dd9a011-612b-4f33-99c0-bfd687021014"), nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
...@@ -192,18 +192,18 @@ func TestOpenShare(t *testing.T) { ...@@ -192,18 +192,18 @@ func TestOpenShare(t *testing.T) {
Expires: nil, Expires: nil,
DownloadLimit: 69, DownloadLimit: 69,
IsPublic: false, IsPublic: false,
Attachments: []Attachment { Attachments: []Attachment{
{ {
ID: uuid.MustParse("2b524827-9c3c-47e0-9277-8b51fd45b4bd"), ID: uuid.MustParse("2b524827-9c3c-47e0-9277-8b51fd45b4bd"),
Filename: "hallo.txt", Filename: "hallo.txt",
Filesize: 123456, Filesize: 123456,
IsEncrypted: false, IsEncrypted: false,
ShareID: uuid.MustParse("e5134044-2704-4864-85be-318fb158009f"), ShareID: uuid.MustParse("e5134044-2704-4864-85be-318fb158009f"),
}, },
}, },
} }
b, _ := json.Marshal(newShare) b, _ := json.Marshal(newShare)
req, _ := http.NewRequest("POST", ts.URL + "/shares", strings.NewReader(string(b))) req, _ := http.NewRequest("POST", ts.URL+"/shares", strings.NewReader(string(b)))
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
body, _ := ioutil.ReadAll(res.Body) body, _ := ioutil.ReadAll(res.Body)
var actual Share var actual Share
...@@ -218,7 +218,7 @@ func TestOpenShare(t *testing.T) { ...@@ -218,7 +218,7 @@ func TestOpenShare(t *testing.T) {
}) })
t.Run("bad request", func(t *testing.T) { t.Run("bad request", func(t *testing.T) {
req, _ := http.NewRequest("POST", ts.URL + "/shares", nil) req, _ := http.NewRequest("POST", ts.URL+"/shares", nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
//body, _ := ioutil.ReadAll(res.Body) //body, _ := ioutil.ReadAll(res.Body)
//fmt.Println(string(body)) //fmt.Println(string(body))
...@@ -235,7 +235,7 @@ func TestCloseShare(t *testing.T) { ...@@ -235,7 +235,7 @@ func TestCloseShare(t *testing.T) {
defer ts.Close() defer ts.Close()
t.Run("happy path", func(t *testing.T) { t.Run("happy path", func(t *testing.T) {
req, _ := http.NewRequest("POST", ts.URL + "/share/a558aca3-fb40-400b-8dc6-ae49c705c791", nil) req, _ := http.NewRequest("POST", ts.URL+"/share/a558aca3-fb40-400b-8dc6-ae49c705c791", nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
body, _ := ioutil.ReadAll(res.Body) body, _ := ioutil.ReadAll(res.Body)
...@@ -245,7 +245,7 @@ func TestCloseShare(t *testing.T) { ...@@ -245,7 +245,7 @@ func TestCloseShare(t *testing.T) {
}) })
t.Run("not found", func(t *testing.T) { t.Run("not found", func(t *testing.T) {
req, _ := http.NewRequest("POST", ts.URL + "/share/e3334044-eeee-4864-85be-555fb158009f", nil) req, _ := http.NewRequest("POST", ts.URL+"/share/e3334044-eeee-4864-85be-555fb158009f", nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
assert.Equal(t, http.StatusNotFound, res.StatusCode) assert.Equal(t, http.StatusNotFound, res.StatusCode)
}) })
...@@ -269,7 +269,7 @@ func TestUploadAttachment(t *testing.T) { ...@@ -269,7 +269,7 @@ func TestUploadAttachment(t *testing.T) {
io.Copy(fw, strings.NewReader("POG POG POG POG")) io.Copy(fw, strings.NewReader("POG POG POG POG"))
writer.Close() writer.Close()
req, _ := http.NewRequest("POST", ts.URL + "/share/a558aca3-fb40-400b-8dc6-ae49c705c791/attachments", bytes.NewReader(body.Bytes())) req, _ := http.NewRequest("POST", ts.URL+"/share/a558aca3-fb40-400b-8dc6-ae49c705c791/attachments", bytes.NewReader(body.Bytes()))
req.Header.Set("Content-Type", writer.FormDataContentType()) req.Header.Set("Content-Type", writer.FormDataContentType())
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
...@@ -281,7 +281,7 @@ func TestUploadAttachment(t *testing.T) { ...@@ -281,7 +281,7 @@ func TestUploadAttachment(t *testing.T) {
}) })
t.Run("bad request", func(t *testing.T) { t.Run("bad request", func(t *testing.T) {
req, _ := http.NewRequest("POST", ts.URL + "/share/a558aca3-fb40-400b-8dc6-ae49c705c791/attachments", nil) req, _ := http.NewRequest("POST", ts.URL+"/share/a558aca3-fb40-400b-8dc6-ae49c705c791/attachments", nil)
res, _ := http.DefaultClient.Do(req) res, _ := http.DefaultClient.Do(req)
assert.Equal(t, http.StatusBadRequest, res.StatusCode) assert.Equal(t, http.StatusBadRequest, res.StatusCode)
}) })
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
// Make a redis pool // Make a redis pool
var redisPool = &redis.Pool{ var redisPool = &redis.Pool{
MaxActive: 5, MaxActive: 5,
MaxIdle: 5, MaxIdle: 5,
Wait: true, Wait: true,
Dial: func() (redis.Conn, error) { Dial: func() (redis.Conn, error) {
return redis.Dial("tcp", ":6379") return redis.Dial("tcp", ":6379")
}, },
...@@ -20,7 +20,7 @@ var redisPool = &redis.Pool{ ...@@ -20,7 +20,7 @@ var redisPool = &redis.Pool{
// Make an enqueuer with a particular namespace // Make an enqueuer with a particular namespace
var enqueuer = work.NewEnqueuer("ChiefSend", redisPool) var enqueuer = work.NewEnqueuer("ChiefSend", redisPool)
type Context struct{ type Context struct {
ShareID uuid.UUID ShareID uuid.UUID
} }
......
...@@ -31,4 +31,4 @@ func SendMail(sh Share) { ...@@ -31,4 +31,4 @@ func SendMail(sh Share) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
} }
\ No newline at end of file
...@@ -3,7 +3,6 @@ package main ...@@ -3,7 +3,6 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/google/uuid"
"log" "log"
"os" "os"
) )
...@@ -19,20 +18,6 @@ var config = struct { ...@@ -19,20 +18,6 @@ var config = struct {
} }
func main() { func main() {
SendMail(Share{
ID: uuid.MustParse("5713d228-a042-446d-a5e4-183b19fa832a"),
Name: "MailTest",
DownloadLimit: 100,
IsPublic: false,
IsTemporary: false,
Password: "test123",
Attachments: []Attachment{
{
Filename: "kekw.txt",
},
},
})
// test database connection // test database connection
db, err := GetDatabase() db, err := GetDatabase()
if err != nil { if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment