cca-entities
v0.2.24
Published
Entities
Readme
Below is a short Markdown documentation that outlines the entities and their relationships:
Entities Documentation
This documentation provides a brief overview of the TypeORM entities used in this project. Each entity extends a common BaseEntity and uses decorators from TypeORM and AutoMapper for mapping and database configuration.
AuthEntity
- Table Name:
auth - Purpose: Stores authentication-related data.
- Key Fields:
- email: A unique email address.
- password: User password (not selected by default).
- refreshToken: Token used for refreshing authentication (not selected by default).
- role: Enum value from
UserRole(default: GUEST).
- Relations:
- user: One-to-one relation with
UserEntity(eagerly loaded, cascades on delete).
- user: One-to-one relation with
UserEntity
- Table Name:
users - Purpose: Represents user profiles.
- Key Fields:
- email: Unique email address (indexed).
- name: User’s name.
- role: Enum value from
UserRole(default: GUEST). - profileImageUrl: Optional URL for the profile image.
- isActive: Indicates if the user is active.
- lastLoginAt: Timestamp of the last login (not selected by default).
- Relations:
- auth: One-to-one relation with
AuthEntity. - posts: One-to-many relation with
PostEntity. - images: One-to-many relation with
ImageEntity.
- auth: One-to-one relation with
CategoryEntity
- Table Name:
categories - Purpose: Represents content categories.
- Key Fields:
- name: Unique category name.
- slug: URL-friendly unique identifier.
- description: Optional text describing the category.
- featuredImage: Optional image for the category.
- level: Indicates the category level.
- Tree Structure:
- parent: Self-referencing parent category (closure-table tree).
- children: Self-referencing child categories.
- Relations:
- image: One-to-one relation with
ImageEntity. - posts: Many-to-many relation with
PostEntity.
- image: One-to-one relation with
PostEntity
- Table Name:
posts - Purpose: Represents blog posts or articles.
- Key Fields:
- title: Title of the post.
- slug: Unique URL-friendly identifier.
- content: Main content of the post.
- excerpt: Short excerpt from the content.
- published: Boolean flag indicating if the post is published.
- featuredImage: Optional image URL.
- publishedAt: Timestamp when the post was published.
- Relations:
- author: Many-to-one relation with
UserEntity(author details). - images: One-to-many relation with
ImageEntity. - categories: Many-to-many relation with
CategoryEntity.
- author: Many-to-one relation with
ImageEntity
- Table Name:
images - Purpose: Stores image data associated with posts, users, or categories.
- Key Fields:
- title: Title of the image.
- description: Optional description.
- originalUrl, thumbUrl, smUrl, mdUrl, lgUrl, xlUrl: URLs for various image sizes.
- imageId: Unique identifier for the image.
- Relations:
- author: Many-to-one relation with
UserEntity. - category: One-to-one relation with
CategoryEntity(if applicable). - post: Many-to-one relation with
PostEntity.
- author: Many-to-one relation with
UserRole Enum
- Values:
ADMINUSERGUEST
This enum is used across several entities to define the user’s access level and role.
This brief documentation provides a high-level overview of the key entities, their main fields, and relationships. For more detailed information on field types, configurations, or relationships, please refer to the inline comments and TypeORM documentation.
