Skip to content

Database_Format

Phillweston edited this page May 7, 2024 · 3 revisions

Database Format for PhotoEditor Server

  • Last Modified: 2024-05-03
  • Author: Phill Weston

Introduction

This document provides a detailed description of the database format for the PhotoEditor-Server service. The service is responsible for storing user interactions with the Twitter API, airdrop claims, promotion codes, and subscription information.

The database for this service is hosted in a MongoDB instance, which is run in a Docker environment. This setup allows for easy scalability and isolation of the database service.

Table of Contents

User Database

  1. Image Download Collection for User

    • Collection Name: imageDownload
    • Index: { userId: 1, fileName: 1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • fileName (string): The name of the file.
      • createdAt (Date): The timestamp of the interaction.
  2. Image Upload Collection for User

    • Collection Name: imageUpload
    • Index: { userId: 1, userAddress: 1, textJSON: 1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • userAddress (string): The address of the user.
      • textJSON (Object|null): The JSON text of the image, null if not available.
      • createdAt (Date): The timestamp of the airdrop claim.
  3. Clipboard Info Collection for User

    • Collection Name: clipboardInfo
    • Index: { userId: 1, userAddress: 1, userPrivateKey: -1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • userAddress (string): The address of the user.
      • userPrivateKey (string): The private key of the user.
      • createdAt (Date): The timestamp of the promotion code creation.
  4. Image Edit Info Collection for User

    • Collection Name: imageEditInfo
    • Index: { fileName: 1, editInfo: 1 }
    • Unique: true
    • Items:
      • fileName (string): The name of the file.
      • editInfo (object): The edit information of the image.
      • createdAt (Date): The timestamp of the promotion code creation.
  5. Keyword Collection for User

    • Collection Name: keywords
    • Index: { keywords: 1 }
    • Unique: false
    • Items:
      • keywords (string): The keywords set to filter the specified name of image.
      • createdAt (Date): The timestamp of the promotion code creation.
  6. User Activation Collection

    • Collection Name: userActivation
    • Index: { userId: 1, userAddress: 1, signature: 1, expirationDate: -1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • userAddress (string): The address of the user.
      • signature (string): The signature of the user.
      • expirationDate (Date): The timestamp of the expiration date of the subscription.
      • createdAt (Date): The timestamp of the promotion code creation.
  7. Subscription Info Collection for User

    • Collection Name: subscriptionInfo
    • Index: { userEmail: 1, userName: 1, subscriptionInfo: 1 }
    • Unique: true
    • Items:
      • userEmail (string): The email of the user.
      • userName (string): (Optional) The name of the user.
      • subscriptionInfo (string): (Optional) The subscription information of the user.
      • createdAt (Date): The timestamp of the subscription info creation.
Clone this wiki locally