gofmt parent backend files
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 36s
CI / test-go-edu-search (push) Successful in 33s
CI / test-python-klausur (push) Failing after 2m45s
CI / test-python-agent-core (push) Successful in 23s
CI / test-nodejs-website (push) Successful in 27s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 36s
CI / test-go-edu-search (push) Successful in 33s
CI / test-python-klausur (push) Failing after 2m45s
CI / test-python-agent-core (push) Successful in 23s
CI / test-nodejs-website (push) Successful in 27s
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user