From 85957ed5db4f7fc7494a7f4862cc8f710f28405b Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Fri, 22 May 2026 11:52:51 +0200 Subject: [PATCH] gofmt parent backend files --- .../internal/database/parent_migrations.go | 8 ++++---- school-service/internal/models/parent.go | 18 +++++++++--------- .../internal/services/parent_service.go | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/school-service/internal/database/parent_migrations.go b/school-service/internal/database/parent_migrations.go index fdb4e3f..50d4a34 100644 --- a/school-service/internal/database/parent_migrations.go +++ b/school-service/internal/database/parent_migrations.go @@ -2,10 +2,10 @@ package database // ParentMigrations creates the four parent-side tables for Phase 9c: // -// parent_account — one row per invited parent (email, language) -// parent_child — kids linked to a parent and a tt_class -// parent_magic_link — one-shot invite tokens, hashed -// parent_session — active browser sessions after redeeming a link +// parent_account — one row per invited parent (email, language) +// parent_child — kids linked to a parent and a tt_class +// parent_magic_link — one-shot invite tokens, hashed +// parent_session — active browser sessions after redeeming a link // // The teacher owns the invite (created_by_user_id on account); parent sees // only data scoped to their own children's class via tt_class.id. diff --git a/school-service/internal/models/parent.go b/school-service/internal/models/parent.go index ec947a4..9cbcba5 100644 --- a/school-service/internal/models/parent.go +++ b/school-service/internal/models/parent.go @@ -15,14 +15,14 @@ type ParentAccount struct { } type ParentChild struct { - ID uuid.UUID `json:"id" db:"id"` - ParentID uuid.UUID `json:"parent_id" db:"parent_id"` - TTClassID uuid.UUID `json:"tt_class_id" db:"tt_class_id"` - FirstName string `json:"first_name" db:"first_name"` - LastName string `json:"last_name" db:"last_name"` - CreatedAt time.Time `json:"created_at" db:"created_at"` + ID uuid.UUID `json:"id" db:"id"` + ParentID uuid.UUID `json:"parent_id" db:"parent_id"` + TTClassID uuid.UUID `json:"tt_class_id" db:"tt_class_id"` + FirstName string `json:"first_name" db:"first_name"` + LastName string `json:"last_name" db:"last_name"` + CreatedAt time.Time `json:"created_at" db:"created_at"` // Joined for display - ClassName string `json:"class_name,omitempty"` + ClassName string `json:"class_name,omitempty"` } // Request DTOs @@ -71,6 +71,6 @@ type RedeemMagicLinkRequest struct { // ParentMe is what /parent/me returns: the account + every linked child. type ParentMe struct { - Parent ParentAccount `json:"parent"` - Children []ParentChild `json:"children"` + Parent ParentAccount `json:"parent"` + Children []ParentChild `json:"children"` } diff --git a/school-service/internal/services/parent_service.go b/school-service/internal/services/parent_service.go index f3edfb5..e507c2b 100644 --- a/school-service/internal/services/parent_service.go +++ b/school-service/internal/services/parent_service.go @@ -28,10 +28,10 @@ func NewParentService(db *pgxpool.Pool) *ParentService { } const ( - magicLinkTTL = 7 * 24 * time.Hour - parentSessionTTL = 30 * 24 * time.Hour - parentCookieName = "bp_parent_session" - tokenLen = 32 // raw bytes; URL-safe base64 encoded + magicLinkTTL = 7 * 24 * time.Hour + parentSessionTTL = 30 * 24 * time.Hour + parentCookieName = "bp_parent_session" + tokenLen = 32 // raw bytes; URL-safe base64 encoded ) func randomToken() (raw string, hash string, err error) {