Skip to content

Commit 571c914

Browse files
committed
Fixed conflicts
2 parents 96d816f + 04548f9 commit 571c914

File tree

1 file changed

+86
-7
lines changed

1 file changed

+86
-7
lines changed

db.go

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,33 @@ type Entry struct {
3030
Tags string `gorm:"column:tags"`
3131
Type string `gorm:"column:type"` // Entry type, default/card/ID
3232
Timestamp time.Time `gorm:"type:timestamp;default:(datetime('now','localtime'))"` // sqlite3
33+
34+
// ID int `gorm:"column:id;autoIncrement;primaryKey"`
35+
// Type string `gorm:"column:type"` // Type of entry - password (default), card, identity etc
36+
// Title string `gorm:"column:title"`
37+
// Name string `gorm:"column:name"` // Card holder name/ID card name - for types cards/identity
38+
// Company string `gorm:"column:company"` // Company name of person - for type identity and
39+
// // Credit card company for type CC
40+
// Number string `gorm:"column:number"` // Number type - CC number for credit cards
41+
// // ID card number for identity types
42+
// SecurityCode string `gorm:"security_code"` // CVV number/security code for CC type
43+
// ExpiryMonth string `gorm:"expiry_month"` // CC or Identity document expiry month
44+
// ExpiryDay string `gorm:"expiry_day"` // Identity document expiry day
45+
// ExpiryYear string `gorm:"expiry_year"` // CC or Identity document expiry year
46+
// FirstName string `gorm:"column:first_name"` // first name - for ID card types
47+
// MiddleName string `gorm:"column:middle_name"` // middle name - for ID card types
48+
// LastName string `gorm:"column:last_name"` // last name - for ID card types
49+
// Email string `gorm:"email"` // Email - for ID card types
50+
// PhoneNumber string `gorm:"phone_number"` // Phone number - for ID card types
51+
52+
// Active bool `gorm:"active;default:true"` // Is the id card/CC active ?
53+
// User string `gorm:"column:user"`
54+
// Url string `gorm:"column:url"`
55+
// Password string `gorm:"column:password"`
56+
// Notes string `gorm:"column:notes"`
57+
// Tags string `gorm:"column:tags"`
58+
// Timestamp time.Time `gorm:"type:timestamp;default:(datetime('now','localtime'))"` // sqlite3
59+
3360
}
3461

3562

@@ -52,16 +79,68 @@ func (ex *ExtendedEntry) TableName() string {
5279
return "exentries"
5380
}
5481

82+
type Address struct {
83+
ID int `gorm:"column:id;autoIncrement;primaryKey"`
84+
Number string `gorm:"column:number"` // Flat or building number
85+
Building string `gorm:"column:building"` // Apartment or building or society name
86+
Street string `gorm:"column:street"` // Street address
87+
Locality string `gorm:"column:locality"` // Name of the locality e.g: Whitefield
88+
Area string `gorm:"column:area"` // Name of the larger area e.g: East Bangalore
89+
City string `gorm:"column:city"` // Name of the city e.g: Bangalore
90+
State string `gorm:"column:state"` // Name of the state e.g: Karnataka
91+
Country string `gorm:"column:country"` // Name of the country e.g: India
92+
93+
Landmark string `gorm:"column:landmark"` // Name of landmark if any
94+
ZipCode string `gorm:"column:zipcode"` // PIN/ZIP code
95+
Type string `gorm:"column:type"` // Type of address: Home/Work/Business
96+
97+
Entry Entry `gorm:"foreignKey:EntryID"`
98+
EntryID int
99+
}
100+
101+
func (ad *Address) TableName() string {
102+
return "address"
103+
}
104+
55105
// Clone an entry
56106
func (e1 *Entry) Copy(e2 *Entry) {
57107

58-
if e2 != nil {
59-
e1.Title = e2.Title
60-
e1.User = e2.User
61-
e1.Url = e2.Url
62-
e1.Password = e2.Password
63-
e1.Notes = e2.Notes
64-
}
108+
if e2 != nil {
109+
switch (e2.Type) {
110+
case "password":
111+
e1.Title = e2.Title
112+
e1.User = e2.User
113+
e1.Url = e2.Url
114+
e1.Password = e2.Password
115+
e1.Notes = e2.Notes
116+
e1.Tags = e2.Tags
117+
e1.Type = e2.Type
118+
case "card":
119+
e1.Title = e2.Title
120+
e1.User = e2.User // card holder name
121+
e1.Issuer = e2.Issuer
122+
e1.Url = e2.Url
123+
e1.Password = e2.Password
124+
e1.ExpiryDate = e2.ExpiryDate
125+
e1.Tags = e2.Tags
126+
e1.Notes = e2.Notes
127+
e1.Type = e2.Type
128+
// case "identity":
129+
// e1.Title = e2.Title
130+
// e1.Name = e2.Name
131+
// e1.Company = e2.Company
132+
// e1.FirstName = e2.FirstName
133+
// e1.LastName = e2.LastName
134+
// e1.MiddleName = e2.MiddleName
135+
// e1.User = e2.User
136+
// e1.Email = e2.Email
137+
// e1.PhoneNumber = e2.PhoneNumber
138+
// e1.Number = e2.Number
139+
// e1.Notes = e2.Notes
140+
// e1.Tags = e2.Tags
141+
// e1.Type = e2.Type
142+
}
143+
}
65144
}
66145

67146
// Clone an entry

0 commit comments

Comments
 (0)