Skip to content

Database_Format

Phillweston edited this page May 16, 2024 · 6 revisions

Database Format for Lotso-Twitter-Auth

  • Last Modified: 2024-04-27
  • Author: Phill Weston

Introduction

This document provides a detailed description of the database format for the Lotso-Twitter-Auth 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

Log Database

  1. Twitter Interaction Collection for Log
    • Collection Name: twitterInteraction
    • Index: None
    • Unique: false
    • Items:
    • userId (string): The ID of the user.
    • type (string): The type of interaction.
    • url (string): The URL of the Twitter API endpoint.
    • requestBody (Object|null): (Optional) The request body.
    • createdAt (Date): The timestamp of the interaction.
    • response (Object|null): (Optional) The response from the Twitter API.
    • error (string|null): (Optional) The error message.

User Database

  1. Twitter Interaction Collection for User

    • Collection Name: twitterInteraction
    • Index: { userId: 1, targetId: 1, type: 1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • targetId (string): The ID of the target user.
      • type (string): The type of interaction.
      • url (string): The URL of the Twitter API endpoint.
      • requestBody (Object|null): (Optional) The request body.
      • createdAt (Date): The timestamp of the interaction.
      • response (string|null): (Optional) The response from the Twitter API.
      • error (string|null): (Optional) The error message.
  2. Airdrop Claim Collection for User

    • Collection Name: airdropClaim
    • Index: { userAddress: 1 }
    • Unique: true
    • Items:
      • userId (string): The ID of the user.
      • userAddress (string): The address of the user.
      • createdAt (Date): The timestamp of the airdrop claim.
  3. Promotion Code Collection for User (Parent)

    • Collection Name: promotionCode
    • Index: { userAddress: 1 }
    • Unique: true
    • Items:
      • userAddress (string): The address of the parent user.
      • promotionCode (string): The promotion code.
      • totalRewardAmount (integer): (Optional) The total reward amount, cannot exceeds the certain threshold.
      • createdAt (Date): The timestamp of the promotion code creation.
  4. User Collection for User (Child)

    • Collection Name: users
    • Index: { userAddress: 1 }
    • Unique: true
    • Items:
      • userAddress (string): The address of the child user.
      • parentAddress (string): (Optional) The address of the parent user.
      • purchase (boolen): The 1st generation $Lotso token purchase status of the child user.
      • createdAt (Date): The timestamp of the promotion code creation.
  5. 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