package models // User represents a system user type User struct { ID string `db:"id" json:"id"` Email string `db:"email" json:"email"` Password string `db:"password" json:"-"` // Never expose password in JSON Role string `db:"role" json:"role"` Name string `db:"name" json:"name"` CreatedAt string `db:"created_at" json:"created_at"` UpdatedAt string `db:"updated_at" json:"updated_at"` } // RefreshToken represents a refresh token stored in the database type RefreshToken struct { ID string `db:"id" json:"id"` UserID string `db:"user_id" json:"user_id"` Token string `db:"token" json:"token"` ExpiresAt string `db:"expires_at" json:"expires_at"` IsRevoked bool `db:"is_revoked" json:"is_revoked"` CreatedAt string `db:"created_at" json:"created_at"` } // PatientDetails contains patient-specific data type PatientDetails struct { PatientID string `json:"patient_id"` PatientName string `json:"patient_name"` StudyInstanceUIDs []string `json:"study_instance_uids,omitempty"` AccessionNumbers []string `json:"accession_numbers,omitempty"` } // DoctorDetails contains doctor-specific data type DoctorDetails struct { DoctorID string `json:"doctor_id"` DoctorName string `json:"doctor_name"` Type string `json:"type"` // "ref_doctor" or "expertise_doctor" } // LoginRequest represents the login form data type LoginRequest struct { Email string `json:"email"` Password string `json:"password"` } // LoginResponse is the response sent after successful login type LoginResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` User *User `json:"user"` RedirectURL string `json:"redirect_url"` } // RefreshRequest represents the refresh token request type RefreshRequest struct { RefreshToken string `json:"refresh_token"` } // RefreshResponse is the response for a token refresh type RefreshResponse struct { AccessToken string `json:"access_token"` } // 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"` }