From 894042060791ec106ad12ddf1b4a7b872c4a6aa6 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 31 Jan 2023 14:45:55 +0530 Subject: added contact and address info to user --- auth/refresh.go | 1 + invoice/invoice.go | 2 +- user/user.go | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/auth/refresh.go b/auth/refresh.go index 5b1a7df..ef01a84 100644 --- a/auth/refresh.go +++ b/auth/refresh.go @@ -42,6 +42,7 @@ func init() { refreshSecret = []byte(conf.RefreshTokenSecret) } +// TODO: check if user even exists and send response accordingly // middleware to check refresh token func verifyRefreshToken() gin.HandlerFunc { return func(ctx *gin.Context) { diff --git a/invoice/invoice.go b/invoice/invoice.go index f7b638a..813ce06 100644 --- a/invoice/invoice.go +++ b/invoice/invoice.go @@ -29,7 +29,7 @@ import ( // initialise a database connection for this package // not sure if I should do this but I am... -var db *mongo.Collection = database.DB.Collection("Invoice") +var db *mongo.Collection = database.DB.Collection("Invoices") /* The *legendary* Invoice struct * Each Recipient, Item in invoice, Address diff --git a/user/user.go b/user/user.go index 6fc6163..3ada9e6 100644 --- a/user/user.go +++ b/user/user.go @@ -19,6 +19,7 @@ package user import ( "errors" + c "github.com/MikunoNaka/OpenBills-server/client" "github.com/MikunoNaka/OpenBills-server/database" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -43,10 +44,15 @@ type Session struct { type User struct { Id primitive.ObjectID `bson:"_id,omitempty" json:"Id"` UserName string `bson:"UserName" json:"UserName"` - Email string `bson:"Email" json:"Email"` - Password string `bson:"Password" json:"Password"` - Config Config `bson:"Config" json:"Config"` - Sessions []Session `bson:"Sessions" json:"Sessions"` + // business title, etc + Title string `bson:"Title" json:"Title"` + Email string `bson:"Email" json:"Email"` + Password string `bson:"Password" json:"Password"` + Config Config `bson:"Config" json:"Config"` + Sessions []Session `bson:"Sessions" json:"Sessions"` + Contact c.Contact `bson:"Contact" json:"Contact"` + Address c.Address `bson:"Address" json:"Address"` + GSTIN string `bson:"GSTIN" json:"GSTIN"` // some actions are only available when email is verified Verified bool `bson:"Verified" json:"Verified"` } -- cgit v1.2.3