Change CreatedAt and UpdatedAt to type Time and update migrations.go accordingly
This commit is contained in:
		@@ -3,6 +3,7 @@ package models
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"GoWeb/app"
 | 
						"GoWeb/app"
 | 
				
			||||||
	"GoWeb/database"
 | 
						"GoWeb/database"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RunAllMigrations defines the structs that should be represented in the database
 | 
					// RunAllMigrations defines the structs that should be represented in the database
 | 
				
			||||||
@@ -13,9 +14,13 @@ func RunAllMigrations(app *app.App) error {
 | 
				
			|||||||
		Username:  "migrate",
 | 
							Username:  "migrate",
 | 
				
			||||||
		Password:  "migrate",
 | 
							Password:  "migrate",
 | 
				
			||||||
		AuthToken: "migrate",
 | 
							AuthToken: "migrate",
 | 
				
			||||||
		CreatedAt: "2021-01-01 00:00:00",
 | 
							CreatedAt: time.Now(),
 | 
				
			||||||
		UpdatedAt: "2021-01-01 00:00:00",
 | 
							UpdatedAt: time.Now(),
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err := database.Migrate(app, user)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return database.Migrate(app, user)
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,8 +19,8 @@ type User struct {
 | 
				
			|||||||
	Username  string
 | 
						Username  string
 | 
				
			||||||
	Password  string
 | 
						Password  string
 | 
				
			||||||
	AuthToken string
 | 
						AuthToken string
 | 
				
			||||||
	CreatedAt string
 | 
						CreatedAt time.Time
 | 
				
			||||||
	UpdatedAt string
 | 
						UpdatedAt time.Time
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetCurrentUser finds the currently logged-in user by session cookie
 | 
					// GetCurrentUser finds the currently logged-in user by session cookie
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user