Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the data schema #13

Open
KL13NT opened this issue Mar 30, 2021 · 2 comments · May be fixed by #15
Open

Refactor the data schema #13

KL13NT opened this issue Mar 30, 2021 · 2 comments · May be fixed by #15
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority

Comments

@KL13NT
Copy link
Owner

KL13NT commented Mar 30, 2021

The current schema is difficult to maintain and use, and forces me to build mumbo jumbo code that is confusing and poor in performance. It's also difficult to get started with since it's difficult to document for onboarding.

The current schema is:

class Entry {
  origin: string;
  lastVisit: Date;
  firstVisit: Date;
  [year]: {
    [month]: {
      [day]: number
    }
  }
}

This schema is not properly built, doesn't adhere to any SOLID principles, difficult to maintain, and is difficult to maintain. The new schema is:

class Session {
  date: Date;
  duration: number;
}

class Entry {
  origin: string;
  lastVisit: Date;
  firstVisit: Date;
  sessions: Array<Session>;
}

This will require an overhaul of the codebase to use the new schema.

@KL13NT KL13NT added documentation Improvements or additions to documentation enhancement New feature or request priority labels Mar 30, 2021
@KL13NT KL13NT self-assigned this Mar 30, 2021
@KL13NT
Copy link
Owner Author

KL13NT commented Apr 1, 2021

IDEA:
Don't transform the datastore itself. Transform the representation by adding an abstraction layer that translates the datastore format into an application format, like an ODM.

@KL13NT
Copy link
Owner Author

KL13NT commented Apr 1, 2021

This proves useless against the current data though. We're still in pre-v1.0.0, so it should be okay to nuke it all.

This was referenced Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant