Commit Graph

130 Commits

Author SHA1 Message Date
02300c69d8 Fix Syndicate paths. 2025-04-04 10:57:06 +01:00
22fbf59157 Forgot to remove handler. 2025-04-04 10:30:28 +01:00
ef4478e8a6 Added syndicate creation and invite logic
- Implemented `CreateSyndicate` with transaction support
- Added `InviteToSyndicate` with membership check and invite insert
- Created syndicate invite model and DB logic for accepting/declining
- Ensured consistent error handling with `fmt.Errorf`
- Cleaned up unused invite handlers/routes
2025-04-04 10:26:24 +01:00
df6608dda5 forgot to stage 2025-04-02 23:53:40 +01:00
053ccf3845 **Untested! ** Add restore functionality for archived messages
- Added `RestoreMessageHandler` and route at `/account/messages/restore`
- Updated `users_messages` table to support `archived_at` reset
- Added restore button to archived messages template
- Ensures archived messages can be moved back into inbox
2025-04-02 23:53:29 +01:00
db5352bc9c Add restore functionality for archived messages
- Added `RestoreMessageHandler` and route at `/account/messages/restore`
- Updated `users_messages` table to support `archived_at` reset
- Added restore button to archived messages template
- Ensures archived messages can be moved back into inbox
2025-04-02 22:18:02 +01:00
dd83081271 Added full message handling system with archive view, pagination, and send support
- Implemented message inbox and archived messages view
- Added pagination logic to both inbox and archive handlers
- Integrated message sending functionality with CSRF protection
- Updated schema to include `archived_at` timestamp
- Included archive button and logic with feedback flash messaging
- Fixed message dropdown routing and rendering in topbar
- Cleaned up template load paths and error handling
2025-04-02 21:29:54 +01:00
e3428911b9 Messages: Add archive (soft-delete) support + dropdown UI polish
- Implemented `/account/messages/archive` route for soft-archiving messages
- Added `is_archived` flag to `users_messages` schema and model
- Topbar dropdown now reflects accurate unread message count
- Fixed missing route registration for archive handler
- Improved message visibility checks to prevent access violations
- Placeholder for rate-limit (429) error page rendering identified
2025-04-02 17:15:57 +01:00
2fd053777d Feature: complete message inbox, view, and topbar integration
Added users_messages schema with correct field naming (senderId, recipientId)

Implemented message count and recent message fetch via storage.GetMessageCount and GetRecentMessages

Fixed field mismatches in SQL queries (recipientId vs recipient_id)

Displayed unread message badge in topbar with truncation for body preview

Linked messages in dropdown to full view (/account/messages/read?id=...)

Added fallback handling for unauthorized/invalid message access

Cleaned up BuildTemplateData to support full message context

Ensured CSRF/session/user context remains intact throughout
2025-04-02 13:41:51 +01:00
b630296b8c Add message system (inbox, read view, dropdown) and truncate helper
Implemented message retrieval and read logic in storage layer

Added handlers for inbox and individual message view

Integrated messages into topbar dropdown with unread badge

Added truncate helper to template functions

Created new templates: messages/index.html and messages/read.html

Fixed missing template function error in topbar rendering
2025-04-02 11:56:11 +01:00
ab1d9abc72 Refactor: Recover middleware now uses RenderError + add full notifications view
- Replaced http.Error with helpers.RenderError in Recover middleware
- Custom 500.html now rendered with layout and topbar on panic
- RenderError gracefully checks template existence and falls back to plain response
- Added /account/notifications full view page (index)
- Linked "Back to notifications" from notification read view
- Fixed typo in template path for notifications/index.html
- Improved layout consistency across error and account pages
2025-04-02 09:54:20 +01:00
2498b33a9c Refactor: Centralize template loading and improve error handling
- Introduced helpers.LoadTemplateFiles() for consistent layout + topbar rendering
- Replaced repeated template.ParseFiles() calls across handlers
- Created generic RenderError(w, r, statusCode) helper
- Replaced old Render403 with flexible RenderError
- Updated AdminOnly middleware to render 403 errors with context
- Added 500.html template for graceful panic fallback
- Prepared structure for future error codes (404, 429, etc.)
2025-04-02 09:12:13 +01:00
f5653f737d Delete synlotto.db 2025-04-01 22:22:46 +00:00
e5bf12ad77 Feature: Full notification read view with conditional mark-as-read logic
- Added dedicated route and view for reading individual notifications (/account/notifications/read)
- Ensured notification is only marked as read if it hasn't already been
- Updated Notification model to use Subject and Body fields
- Fixed field references in templates (Title → Subject, Message → Body)
- Updated topbar dropdown to use correct field names and display logic
- Gracefully handle "notification not found" cases in template output
- Ensured consistent template parsing with layout and topbar inclusion
- Improved error logging for better diagnosis
2025-04-01 23:08:58 +01:00
06e647d00f Feature: Add account-protected route to mark notifications as read
- Created /account/notifications/read endpoint secured by session middleware
- Ensured users can only mark their own notifications as read
- Updated dropdown links to point to /account/notifications/read?id={id}
- Improved notification security by matching user_id in DB update
- Added redirect flow to full notifications page after marking read
- Logged DB errors to assist debugging
2025-04-01 22:12:41 +01:00
1e372da57d adjust count mechanism. 2025-04-01 21:39:57 +01:00
d5b953475c schema update, no sender name required. 2025-04-01 21:38:08 +01:00
5ea780fcab Cleanup: Finalize template context integration and remove legacy code
- Replaced legacy TemplateContext calls with structured TemplateData usage
- Removed unused variables and redundant storage calls in notifications handler
- Ensured consistent use of BuildTemplateData across user-facing handlers
- Resolved all compile-time errors from refactor
- Ready for runtime testing and further layout integration
2025-04-01 21:20:05 +01:00
03b1e095ce Refactor: Centralize template context using unified TemplateData struct
- Introduced models.TemplateData for shared user/context state
- Moved context construction logic into handlers/template_context.go
- Simplified helpers.TemplateContext to accept structured data
- Restored and organized template helper functions
- Updated affected handlers (main.go, draw_handler.go, notifications.go)
- Improved scalability and separation of concerns in template rendering
2025-04-01 21:08:00 +01:00
6dbac8ab14 Already exists in helpers. 2025-04-01 16:02:59 +01:00
b79621cf9f Should not be in template.go should be template functions. 2025-04-01 16:01:33 +01:00
e68559ad3d thing this are broken but checking in so i have a state to revert too. 2025-04-01 15:52:31 +01:00
8469f02eb8 add db to ignore. 2025-04-01 15:50:39 +01:00
0e20cc023c more changes but unsure of state had to trash last set fof changes and try repair. 2025-04-01 15:50:15 +01:00
5aaddf16f1 More layout and customisations. 2025-04-01 10:19:56 +01:00
aaf90b55da Lots of UI and admin changes, need to clean up the three audit log tables and a few other niggles. 2025-04-01 00:05:48 +01:00
7eefb9ced0 Additional security and hardening. 2025-03-31 15:14:16 +01:00
c3a7480c65 expand on admin functionality, hardening still needs to be implemented. 2025-03-31 10:52:12 +01:00
b466c351da Fixzed display of prize tiers on tickets 2025-03-30 23:51:27 +01:00
f8dab97a54 Working through issue where prizes are incorrect and need updating. 2025-03-29 15:42:14 +00:00
c0143df8c0 not required already in layout 2025-03-28 22:55:38 +00:00
322b4877ed New admin triggers for db maintenance, updating display of prize results and logic fix 2025-03-28 22:52:54 +00:00
593dbb598e update table for prizes. 2025-03-28 15:27:10 +00:00
94a4274732 removed commented prize 2025-03-28 15:21:42 +00:00
0d33d65844 finalise ball colourings and display 2025-03-28 15:20:56 +00:00
75d8d1700e updated so balls are coloured to their respective game. need to thing about set for life. 2025-03-28 14:52:50 +00:00
cabc283673 madness continues 2025-03-28 13:04:53 +00:00
23e0208317 Lots of changes around viewing tickets from css perspective logic changes nwe handlers and service triggers... just lots of stuff... 2025-03-28 10:05:54 +00:00
e13b375af7 Lots of changes, still more to do 2025-03-27 15:03:43 +00:00
27b862b84b structs for matching results to tickets. 2025-03-27 10:45:29 +00:00
204cfb1539 create lotto results table. 2025-03-27 10:44:09 +00:00
f3949717b8 Can't remember why i added this lol 2025-03-27 10:43:45 +00:00
f7b54db7c1 Get ticket functionality. 2025-03-26 15:33:40 +00:00
66abdbdd4d Add tickets to db. 2025-03-26 13:26:43 +00:00
f001cfe35e update ticket handler 2025-03-26 10:09:31 +00:00
9df4b173fb remove println 2025-03-26 09:43:01 +00:00
c736b95c50 remove println 2025-03-26 09:42:44 +00:00
06a7296285 update my tickets table creation 2025-03-26 09:42:02 +00:00
8dc4f61089 new helper for adding tickets 2025-03-26 09:41:39 +00:00
eae4561e1f new ticket functions 2025-03-26 09:41:22 +00:00