From 4bb46084477c9f6fba93d84a7feea2ba63804362 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Sat, 9 May 2020 22:30:14 -0600 Subject: Add title to post --- backend/db/db.go | 5 +++-- backend/db/schemas.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'backend/db') diff --git a/backend/db/db.go b/backend/db/db.go index 053ba87..4f638fd 100644 --- a/backend/db/db.go +++ b/backend/db/db.go @@ -24,8 +24,8 @@ func init() { initSessions(mUser, mPass, mIP) } -// creates a new paste with content and hash -func New(ip, content, expiry string) error { +// creates a new paste with title, content and hash +func New(ip, content, expiry, title string) error { // generate hash from ip hash := hashing.GenerateURI(ip) @@ -33,6 +33,7 @@ func New(ip, content, expiry string) error { new := Paste{ Hash: hash, Content: content, + Title: title, } // check if expiry diff --git a/backend/db/schemas.go b/backend/db/schemas.go index bdfa60c..62c5a11 100644 --- a/backend/db/schemas.go +++ b/backend/db/schemas.go @@ -12,4 +12,5 @@ type Paste struct { Hash string Content string Expiry time.Time `bson:"expiry"` + Title string } -- cgit v1.2.3