package models // ShortLink represents a short URL token for patient access type ShortLink struct { ID string `db:"id" json:"id"` Token string `db:"token" json:"token"` // The short token used in the URL PatientID string `db:"patient_id" json:"patient_id"` StudyUID string `db:"study_uid" json:"study_uid"` // The StudyInstanceUID this token grants access to HashedDOB string `db:"hashed_dob" json:"-"` // Hashed Date of Birth for verification ExpiresAt string `db:"expires_at" json:"expires_at"` IsRevoked bool `db:"is_revoked" json:"is_revoked"` CreatedAt string `db:"created_at" json:"created_at"` CreatedByID string `db:"created_by_id" json:"created_by_id"` // ID of admin who created this RemainingTries int `db:"remaining_tries" json:"-"` // Number of failed attempts allowed } // GenerateShortLinkRequest represents request to create a short URL type GenerateShortLinkRequest struct { PatientID string `json:"patient_id"` StudyUID string `json:"study_uid"` DOB string `json:"dob"` // Date of birth in YYYY-MM-DD format ExpiresIn int `json:"expires_in"` // Expiry in hours (optional, defaults to 72) } // GenerateShortLinkResponse is the response for a generated short link type GenerateShortLinkResponse struct { ShortToken string `json:"short_token"` FullURL string `json:"full_url"` ExpiresAt string `json:"expires_at"` } // ShortLinkAuthRequest represents the shortlink authentication request type ShortLinkAuthRequest struct { ShortToken string `json:"short_token,omitempty"` // The original field ShortTokenAlt string `json:"shortToken,omitempty"` // Support for camelCase naming from OHIF DOB string `json:"dob"` // Date of birth in YYYY-MM-DD format } func (r *ShortLinkAuthRequest) GetToken() string { // Use ShortTokenAlt if ShortToken is empty if r.ShortToken == "" { return r.ShortTokenAlt } return r.ShortToken } // ShortLinkAuthResponse is the response for successful shortlink authentication type ShortLinkAuthResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` // Token expiry in seconds RedirectURL string `json:"redirect_url"` }