diff options
| author | Ryan Mehri <[email protected]> | 2020-05-17 11:03:24 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-17 11:03:24 -0600 |
| commit | 3fb2647699bc1a57f718d384860cf2279fa8222e (patch) | |
| tree | 48d6eb2adeef0c9058734e5941fb7fddfc031bb4 /backend/db | |
| parent | Merge pull request #26 from jackyzha0/raw-button (diff) | |
| parent | remove lang input (diff) | |
| download | ctrl-v-3fb2647699bc1a57f718d384860cf2279fa8222e.tar.xz ctrl-v-3fb2647699bc1a57f718d384860cf2279fa8222e.zip | |
Merge pull request #27 from jackyzha0/save-lang
save lang
Diffstat (limited to 'backend/db')
| -rw-r--r-- | backend/db/db.go | 9 | ||||
| -rw-r--r-- | backend/db/schemas.go | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/backend/db/db.go b/backend/db/db.go index df112d0..258b4df 100644 --- a/backend/db/db.go +++ b/backend/db/db.go @@ -28,7 +28,7 @@ const TitleLimit = 100 const ContentLimit = 100000 // creates a new paste with title, content and hash, returns the hash of the created paste -func New(ip, content, expiry, title, password string) (string, error) { +func New(ip, content, expiry, title, password, lang string) (string, error) { // generate hash from ip hash := security.GenerateURI(ip) @@ -40,9 +40,10 @@ func New(ip, content, expiry, title, password string) (string, error) { // create new struct new := Paste{ - Hash: hash, - Content: content, - Title: title, + Hash: hash, + Content: content, + Title: title, + Language: lang, } // if there is a password, encrypt content and hash the password diff --git a/backend/db/schemas.go b/backend/db/schemas.go index d3551fc..a3b55d0 100644 --- a/backend/db/schemas.go +++ b/backend/db/schemas.go @@ -10,9 +10,10 @@ import ( type Paste struct { ID bson.ObjectId `bson:"_id,omitempty"` Hash string - Content string - Expiry time.Time `bson:"expiry"` Title string + Content string + Language string Password string + Expiry time.Time `bson:"expiry"` Salt []byte } |