dscpsyl / loget-japan-tracker

A simple site to keep track of all of your collected cards from the LoGet tourist cards by Japan.
https://loget.printhello.world
GNU Affero General Public License v3.0
0 stars 0 forks source link

Database creation #1

Closed dscpsyl closed 1 month ago

dscpsyl commented 1 month ago

We need to decide and create the database to hold all the information.

The current idea: We have a NoSQL database with two documents. One has all the data from the cards from the Loget Site. This will automatically be updated to match the website via a scraper with the required information. The other table will be the user table with SSO and a set that contains the cardId's of all the cards someone claims to have collected. The frontend will update based on this list.

dscpsyl commented 1 month ago

Below we have a dbml file describing the basic idea of the database structure.

// Use DBML to define your database structure
// Docs: https://dbml.dbdiagram.io/docs

Enum series {
  One
  Two
  Three
  Four
  Five
  Promotional
  Limited
}

Enum brandimg {
  img
  null
}

Table cards { // Scrapped from the loget website https://loget-card.jp/list_card.aspx
  Id interger [pk]
  Name varchar
  Series series
  Image img
  Region list [note:"A list of region filters from broad to specific based on website"]
  SpotmapLink link
  SpotWebsiteLink link
  Pictogram img 
  BrandImg  brandimg
}

Table users {
  Id interger
  username varchar
  email varchar [pk]
  cardsCollected set [note: "a set of cards.Id that have been collected. if it is not in this set, then it has not been collected"]
}

Ref: users.cardsCollected > cards.Id
dscpsyl commented 1 month ago

Based on this structure, it makes sense to use a NoSQL db. As such, we will choose MongoDB for ease of development.

dscpsyl commented 1 month ago

For now, the region list will be removed from the database as its cost to implement outweigh the benefits

dscpsyl commented 1 month ago

I wrote the models in Django ODM, hoping that Djongo could connect them, but then I realized that it is not supported anymore. It seems we either have to abandon Django ODM or choose one of the supported DBs, which isn't the worst idea.

dscpsyl commented 1 month ago

Database creation has been successful. We are now working on the front end with user interaction