Repository navigation
Database ‐ Schema
Enoch Olayemi edited this page Jul 8, 2026
·
2 revisions
This page documents the current important Mongoose models used by Tapitude Creator Hub.
Model file:
src/models/User.tsPurpose:
- Stores admin and creator login accounts.
Important fields:
name
email
passwordHash
role
status
createdAt
updatedAtRoles:
admin
creatorStatuses:
active
disabledImportant methods:
createAccountfindByEmailcomparePassworddisableAccountenableAccountchangePassword
Model file:
src/models/CreatorProfile.tsPurpose:
- Stores creator profile and public hub branding information.
Important fields:
userId
creatorSlug
displayName
brandName
brandColor
bio
profileImageKey
totalViews
totalLikes
createdAt
updatedAtNotes:
-
userIdreferences the creator'sUser. -
creatorSlugis generated from the user id when the profile is saved. -
profileImageKeyreferences uploaded file metadata.
Model file:
src/models/ContentPage.tsPurpose:
- Stores creator posts/content pages shown in the content hub.
Important fields currently defined in the schema:
creatorId
fileKey
body
publishDate
likes
viewedBy
preserveAspectRatio
createdAt
updatedAtNotes:
-
creatorIdreferences the creator'sUser. -
fileKeyreferences uploaded file metadata. -
publishDateis used to determine whether a post is scheduled or published. -
viewedByhelps prevent counting the same viewer repeatedly. -
preserveAspectRatiocontrols how media should display.
Known issue:
- Current controllers and views also reference a
statusfield. The schema should be updated to includestatusor the code should be simplified to usepublishDateonly.
Model/service file:
src/models/FileService.tsPurpose:
- Stores metadata for uploaded files and manages local file operations.
Important metadata fields:
fileKey
originalName
contentType
fileSize
ownerId
createdAt
isActiveStorage behavior:
- Physical files are saved in
storage/. - The browser can access files through
/storage/<fileKey>. - The app stores
fileKeyon content pages and creator profiles.
Model file:
src/models/AuditLog.jsPurpose:
- Provides a schema for logging important system/admin actions.
Important fields:
actorUserId
action
targetType
targetId
metadata
createdAt
updatedAtNote:
- The model exists, but audit logging does not appear to be a major active workflow yet.
Recommended indexes to confirm:
users.email unique
users.role
users.status
creatorprofiles.userId unique
creatorprofiles.creatorSlug unique
contentpages.creatorId
contentpages.publishDate
files.fileKey
files.ownerId
auditlogs.actorUserId
auditlogs.targetType + targetIdThe old wiki mentioned fields that are not part of the current codebase:
title-
slugon content posts buttonTextexternalLinkscheduledForpublishedAtthemeSettingssupportEmail- Separate
media_assetsmodel - Separate
analytics_eventsmodel
These should not be documented as current implementation unless the team reintroduces them.