feat: add Go models for User and UserProfile
- Create models/user.go with bcrypt password hashing - Create models/user_profile.go with foreign key relationship - Add GORM hooks for automatic profile creation - Include proper JSON tags and database constraints
This commit is contained in:
		
							parent
							
								
									e40a119bdc
								
							
						
					
					
						commit
						3ed698918b
					
				
					 5 changed files with 52 additions and 75 deletions
				
			
		
							
								
								
									
										12
									
								
								models/user_profile.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								models/user_profile.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| package models | ||||
| 
 | ||||
| type UserProfile struct { | ||||
| 	ID             uint   `gorm:"primaryKey" json:"id"` | ||||
| 	UserID         uint   `gorm:"not null" json:"user_id"` | ||||
| 	FirstName      string `gorm:"size:80;not null" json:"first_name"` | ||||
| 	LastName       string `gorm:"size:80;not null" json:"last_name"` | ||||
| 	Bio            string `gorm:"type:text" json:"bio"` | ||||
| 	ProfilePicture string `gorm:"size:255" json:"profile_picture"` | ||||
| 
 | ||||
| 	User *User `gorm:"foreignKey:UserID" json:"user,omitempty"` | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Cipher Vance
						Cipher Vance