https://mermaid.ai/d/2f3c83c9-94f9-48b7-909f-acd631165463

변경히스토리

erDiagram
    Apartment {
        String id PK
        String name
        String address
        String officeNumber
        String description
        DateTime createdAt
        DateTime updatedAt
        ApartmentStatus apartmentStatus
        String apartmentboardId FK
        String adminId FK
    }

    ApartmentStructureGroup {
        String id PK
        String apartmentId FK
        String dongList
        Int startFloor
        Int maxFloor
        Int unitsPerFloor
        DateTime createdAt
        DateTime updatedAt
    }

    ApartmentUnit {
        String id PK
        String apartmentId FK
        String dong
        Int floor
        String ho
        Boolean isActive
        DateTime createdAt
    }

    ApartmentBoard {
        String id PK
        DateTime createdAt
        DateTime updatedAt
    }

    User {
        String id PK
        String username
        String password
        String contact
        String name
        String email
        String image
        Role role
        String apartmentId FK
        String apartmentUnitId FK
        JoinStatus joinStatus
        DateTime createdAt
        DateTime updatedAt
    }

    Resident {
        String id PK
        String dong
        String ho
        String name
        String contact
        HouseHolderStatus isHouseholder
        String userId FK
        String apartmentId FK
        ResidenceStatus residenceStatus
    }

    Notice {
        String id PK
        NoticeCategory category
        String title
        String content
        Boolean isImportant
        Boolean isSchedule
        DateTime startDate
        DateTime endDate
        Int viewCount
        Int commentsCount
        Boolean isPinned
        String authorId FK
        String apartmentboardId FK
        DateTime createdAt
        DateTime updatedAt
    }

    Complaint {
        String id PK
        String title
        String content
        Boolean isPublic
        ComplaintStatus status
        Int viewCount
        Int commentsCount
        String authorId FK
        String apartmentboardId FK
        DateTime createdAt
        DateTime updatedAt
    }

    Comment {
        String id PK
        String content
        String authorId FK
        String noticeId FK
        String complaintId FK
        String voteId FK
        DateTime createdAt
        DateTime updatedAt
    }

    Vote {
        String id PK
        String title
        String content
        Int targetScope
        DateTime startDate
        DateTime endDate
        VoteStatus status
        String authorId FK
        String apartmentboardId FK
        DateTime createdAt
        DateTime updatedAt
    }

    VoteOption {
        String id PK
        String content
        Int voteCount
        String voteId FK
        DateTime createdAt
        DateTime updatedAt
    }

    VoteRecord {
        String id PK
        String userId FK
        String voteId FK
        String voteOptionId FK
        DateTime createdAt
    }

    Notification {
        String id PK
        String content
        NotificationType notificationType
        Boolean isChecked
        String noticeId FK
        String complaintId FK
        String voteId FK
        String userId FK
        DateTime createdAt
        DateTime updatedAt
    }

    Event {
        String id PK
        String title
        BoardType type
        DateTime startDate
        DateTime endDate
        NotificationType category
        String apartmentId FK
        String noticeId FK
        String voteId FK
        DateTime createdAt
        DateTime updatedAt
    }

    DeletedFile {
        String id PK
        String fileKey
        String reason
        DateTime createdAt
    }

    %% Relationships
    Apartment ||--|| ApartmentBoard : "has (1:1)"
    Apartment ||--o| User : "admin (1:1)"
    Apartment ||--o{ ApartmentStructureGroup : "has structure groups"
    Apartment ||--o{ ApartmentUnit : "has units"
    Apartment ||--o{ User : "has users"
    Apartment ||--o{ Resident : "has residents"
    Apartment ||--o{ Event : "has events"

    ApartmentUnit ||--o{ User : "houses users"

    ApartmentBoard ||--o{ Notice : "has notices"
    ApartmentBoard ||--o{ Complaint : "has complaints"
    ApartmentBoard ||--o{ Vote : "has votes"

    User ||--o| Resident : "linked to"
    User ||--o{ Notice : "authors"
    User ||--o{ Complaint : "authors"
    User ||--o{ Comment : "authors"
    User ||--o{ Vote : "creates"
    User ||--o{ VoteRecord : "submits"
    User ||--o{ Notification : "receives"

    Notice ||--o{ Comment : "has comments"
    Notice ||--o{ Notification : "triggers"
    Notice ||--o{ Event : "linked to event"

    Complaint ||--o{ Comment : "has comments"
    Complaint ||--o{ Notification : "triggers"

    Vote ||--o{ VoteOption : "has options"
    Vote ||--o{ VoteRecord : "has records"
    Vote ||--o{ Comment : "has comments"
    Vote ||--o{ Notification : "triggers"
    Vote ||--o{ Event : "linked to event"

    VoteOption ||--o{ VoteRecord : "chosen in"