|
|
|
@ -1,3 +1,24 @@ |
|
|
|
|
/* |
|
|
|
|
This contains the base classes for the `Model`s in the database. It uses |
|
|
|
|
the [lib/ormish.js](/admin/#/docs/lib/ormish.js) module to build up classes for: |
|
|
|
|
|
|
|
|
|
+ `User` -- A simple user model. |
|
|
|
|
+ `Payment` -- A Payment model that is simple but can support Stripe, Paypal, and BTCPayServer. |
|
|
|
|
+ `Product` -- A simple Product for the site. |
|
|
|
|
+ `Media` -- Media information common to video and music files, but could work with anything. |
|
|
|
|
+ `Livestream` -- Metadata for livestream sessions (see `client/pages/Livestream.svelte`). |
|
|
|
|
+ `Site` -- Simple key=value store for settings you might want in your site. |
|
|
|
|
|
|
|
|
|
As with all other code in this project these models are _complete_ but don't have everything |
|
|
|
|
under the sun. For example, it acts as if `User` pays one time to access the entire site and |
|
|
|
|
all `Product`. That is one very valid model of payment, and it's the simplest one which you |
|
|
|
|
can then build on. The rationale is you get a starter kit that you can then mold into what you |
|
|
|
|
need because this is simple enough to understand while also being useful to get started. |
|
|
|
|
|
|
|
|
|
### Tests |
|
|
|
|
|
|
|
|
|
You should look at the tests in `tests/models` for many examples of using these. |
|
|
|
|
*/ |
|
|
|
|
import { knex, Model } from './ormish.js'; |
|
|
|
|
import bcrypt from 'bcryptjs'; |
|
|
|
|
import {v4 as uuid} from "uuid"; |
|
|
|
|