aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorSamuel Johnson <[email protected]>2025-11-25 19:47:20 -0500
committerSamuel Johnson <[email protected]>2025-11-25 19:47:20 -0500
commit3c237fc659c2829042407697ca7aa3e1442a5719 (patch)
tree6557b2faa27eb9880ef96c8755bed3f8a461d2ae /internal
parent368a462bc744d8e9084eacfaddeb9afcaf7f7133 (diff)
Add post editing interface
Diffstat (limited to 'internal')
-rw-r--r--internal/dbmigrations.go2
-rw-r--r--internal/models/post.go9
2 files changed, 8 insertions, 3 deletions
diff --git a/internal/dbmigrations.go b/internal/dbmigrations.go
index e6c11ff..d5f4836 100644
--- a/internal/dbmigrations.go
+++ b/internal/dbmigrations.go
@@ -33,7 +33,7 @@ func Migrate (db *sql.DB, webmaster string, passOne string, passTwo string) {
_, table_check = db.Query("SELECT * FROM posts;")
if table_check != nil {
- _, err := db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES logins(id), time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, content TEXT NOT NULL);")
+ _, err := db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, user_id INTEGER REFERENCES logins(id), time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, brief TEXT NOT NULL, content TEXT NOT NULL);")
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to create posts table: %v\n", err)
os.Exit(1)
diff --git a/internal/models/post.go b/internal/models/post.go
index d7b006d..d7f1aaa 100644
--- a/internal/models/post.go
+++ b/internal/models/post.go
@@ -1,10 +1,15 @@
package models
-import "html/template"
+import (
+ "html/template"
+ "time"
+)
type Post struct {
Id int
Name string
- Time string
+ Time time.Time
+ FormattedTime string
+ Brief template.HTML
Content template.HTML
}