Files
honeyDueAPI/internal/admin/tables/notifications.go
Trey t 1f12f3f62a Initial commit: MyCrib API in Go
Complete rewrite of Django REST API to Go with:
- Gin web framework for HTTP routing
- GORM for database operations
- GoAdmin for admin panel
- Gorush integration for push notifications
- Redis for caching and job queues

Features implemented:
- User authentication (login, register, logout, password reset)
- Residence management (CRUD, sharing, share codes)
- Task management (CRUD, kanban board, completions)
- Contractor management (CRUD, specialties)
- Document management (CRUD, warranties)
- Notifications (preferences, push notifications)
- Subscription management (tiers, limits)

Infrastructure:
- Docker Compose for local development
- Database migrations and seed data
- Admin panel for data management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 20:07:16 -06:00

52 lines
2.4 KiB
Go

package tables
import (
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/db"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
"github.com/GoAdminGroup/go-admin/template/types"
"github.com/GoAdminGroup/go-admin/template/types/form"
)
// GetNotificationsTable returns the notifications table configuration
func GetNotificationsTable(ctx *context.Context) table.Table {
notifications := table.NewDefaultTable(ctx, table.DefaultConfigWithDriver(db.DriverPostgresql))
info := notifications.GetInfo()
info.SetTable("notifications_notification")
info.AddField("ID", "id", db.Int).FieldFilterable()
info.AddField("User ID", "user_id", db.Int).FieldFilterable()
info.AddField("Title", "title", db.Varchar).FieldFilterable().FieldSortable()
info.AddField("Message", "message", db.Text)
info.AddField("Type", "notification_type", db.Varchar).FieldFilterable()
info.AddField("Is Read", "is_read", db.Bool).FieldFilterable()
info.AddField("Task ID", "task_id", db.Int).FieldFilterable()
info.AddField("Residence ID", "residence_id", db.Int).FieldFilterable()
info.AddField("Created At", "created_at", db.Timestamp).FieldSortable()
info.SetFilterFormLayout(form.LayoutThreeCol)
formList := notifications.GetForm()
formList.SetTable("notifications_notification")
formList.AddField("ID", "id", db.Int, form.Default).FieldNotAllowAdd().FieldNotAllowEdit()
formList.AddField("User ID", "user_id", db.Int, form.Number).FieldMust()
formList.AddField("Title", "title", db.Varchar, form.Text).FieldMust()
formList.AddField("Message", "message", db.Text, form.TextArea).FieldMust()
formList.AddField("Type", "notification_type", db.Varchar, form.SelectSingle).
FieldOptions(types.FieldOptions{
{Value: "task_assigned", Text: "Task Assigned"},
{Value: "task_completed", Text: "Task Completed"},
{Value: "task_due", Text: "Task Due"},
{Value: "task_overdue", Text: "Task Overdue"},
{Value: "residence_shared", Text: "Residence Shared"},
{Value: "system", Text: "System"},
})
formList.AddField("Is Read", "is_read", db.Bool, form.Switch).FieldDefault("false")
formList.AddField("Task ID", "task_id", db.Int, form.Number)
formList.AddField("Residence ID", "residence_id", db.Int, form.Number)
formList.AddField("Data JSON", "data", db.Text, form.TextArea)
formList.AddField("Action URL", "action_url", db.Varchar, form.Url)
return notifications
}