6.2 KiB
6.2 KiB
FORMAT
Title: Database Schema
Database Type: PostgreSQL
Core Entities
Profile
- Description: Lưu thông tin người tham gia
- Fields:
id(UUID, PRIMARY KEY): Unique identifierfullName(TEXT): Tên đầy đủ người dùngdateOfBirth(DATE): Ngày sinhgender(TEXT): Giới tínhpreferredGender(TEXT): Giới tính mong muốnphoneNumber(TEXT): Số điện thoạiemail(TEXT): EmailfacebookLink(TEXT): Link FacebookphotoReference(TEXT): Reference to stored photolocation(TEXT): Khu vựcteam(TEXT): Team choicehobbies(TEXT[]): Sở thíchthingsNotTried(TEXT): Thứ chưa thử quahopesForPartner(TEXT): Mong muốn đối với đối tácdealbreakers(TEXT): Ranh giớimessageToPartner(TEXT): Thông điệp gửi đối táczodiacSign(TEXT): Cung hoàng đạoaccessCode(TEXT): Code truy cập kết quảpersonalLink(TEXT): Link cá nhânacceptedTerms(BOOLEAN): Chấp nhận điều khoảnregistrationTimestamp(TIMESTAMP): Thời điểm đăng kýstatus(TEXT): Trạng tháiisLuckyWinner(BOOLEAN): Có trúng thưởngcreatedAt(TIMESTAMP): Thời điểm tạoupdatedAt(TIMESTAMP): Thời điểm cập nhật
MatchOutcome
- Description: Lưu kết quả matching cho một Profile
- Fields:
id(UUID, PRIMARY KEY): Unique identifierprofileId(UUID, FK): ID hồ sơpotentialMatchProfileIds(UUID[]): Danh sách ID 3 đối tượng phù hợpmatchScores(JSON): Điểm matchstatus(TEXT): Trạng tháiselectedProfileId(UUID): ID hồ sơ được chọngenerationTimestamp(TIMESTAMP): Thời điểm tạo kết quảaccessedTimestamp(TIMESTAMP): Thời điểm truy cậpselectionTimestamp(TIMESTAMP): Thời điểm chọncreatedAt(TIMESTAMP): Thời điểm tạoupdatedAt(TIMESTAMP): Thời điểm cập nhật
GiftAllocation
- Description: Ghi nhận việc phân bổ quà tặng
- Fields:
id(UUID, PRIMARY KEY): Unique identifierprofileId(UUID, FK): ID hồ sơgiftId(UUID, FK): ID quàallocationTimestamp(TIMESTAMP): Thời điểm phân bổnotificationStatus(TEXT): Trạng thái thông báonotificationSentTimestamp(TIMESTAMP): Thời điểm gửi thông báocreatedAt(TIMESTAMP): Thời điểm tạoupdatedAt(TIMESTAMP): Thời điểm cập nhật
Gift
- Description: Lưu thông tin các loại quà tặng
- Fields:
id(UUID, PRIMARY KEY): Unique identifiername(TEXT): Tên quàdescription(TEXT): Mô tảimageUrl(TEXT): URL hình ảnhisActive(BOOLEAN): Trạng thái hoạt độngcreatedAt(TIMESTAMP): Thời điểm tạoupdatedAt(TIMESTAMP): Thời điểm cập nhật
Indexes
profiles_email_idx: Index trên trường email của Profileprofiles_access_code_idx: Index trên trường accessCode của Profilematch_outcomes_profile_id_idx: Index trên trường profileId của MatchOutcome
DATA SCHEMA AND STRUCTURES
1. Database Schema
Table: [Table Name]
Description: [Brief description of the table's purpose]
Columns:
- [Column Name] (
[Data Type]): [Brief description]. Constraints:[Constraint(s)]. [PK/FK (references Table(Column))] [Index (Type)]
Relationships:
[Table Name][Relationship Type][Another Table Name](on[Column Name]->[Another Table Name].[Column Name])
Indexes:
[Index Name]on[Column(s)]([Index Type])
2. Generic Data Declarations
2.1. [Data Structure Name]
Description: [Brief description of the purpose of this data structure.]
Fields:
- [Field Name] (
[Data Type]): [Brief description of the field]. [Constraints/Rules]
Example (Optional):
{
"[field name]": "[example value]",
"[another field]": "[example value]"
}
3. Application-Specific Data Structures
3.1. Profile Aggregate
Description: Aggregate for storing user profile information.
Fields:
type Profile struct {
ID string
FullName string
DateOfBirth time.Time
Gender string
PreferredGender string
PhoneNumber string
Email string
FacebookLink string
PhotoReference string
Location string
Team string
Hobbies []string
ThingsNotTried []string
HopesForPartner string
Dealbreakers string
MessageToPartner string
ZodiacSign string
AccessCode string
PersonalLink string
AcceptedTerms bool
RegistrationTimestamp time.Time
Status string
IsLuckyWinner bool
CreatedAt time.Time
UpdatedAt time.Time
}
3.2. MatchOutcome Aggregate
Description: Aggregate for storing match outcome information.
Fields:
type MatchOutcome struct {
ID string
ProfileID string
PotentialMatchProfileIDs []string
MatchScores map[string]float64 // Optional
Status string
SelectedProfileID string
GenerationTimestamp time.Time
AccessedTimestamp time.Time
SelectionTimestamp time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
3.3. GiftAllocation Aggregate
Description: Aggregate for storing gift allocation information.
Fields:
type GiftAllocation struct {
ID string
ProfileID string
GiftID string
AllocationTimestamp time.Time
NotificationStatus string
NotificationSentTimestamp time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
3.4. Gift Aggregate
Description: Aggregate for storing gift information.
Fields:
type Gift struct {
ID string
Name string
Description string
ImageURL string // Optional
IsActive bool
CreatedAt time.Time
UpdatedAt time.Time
}