Skip to content

Instantly share code, notes, and snippets.

@acobster
Last active February 16, 2025 04:04
Show Gist options
  • Save acobster/5f37860ca8804a35783b584e2a93305c to your computer and use it in GitHub Desktop.
Save acobster/5f37860ca8804a35783b584e2a93305c to your computer and use it in GitHub Desktop.
```sql
email varchar(100),
code varchar(64),
date_invited timestamp,
invited_by integer,
redeemed boolean,
UNIQUE (email, code),
```
(def routes
["/~"
["/login" {:dispatcher/type ::auth/login=>
:dispatcher/component #'auth/LoginPage}]
["/reset" {:dispatcher/type ::auth/reset=>
:dispatcher/component #'auth/ResetPage}]
;; invitations
["/invite" {:dispatcher/type ::signup/invite=>
:dispatcher/component #'signup/InvitePage}]
["/redeem" {:dispatcher/type ::signup/redeem=>
:dispatcher/component #'signup/SignupPage}]
;; open signups
["/signup" {:dispatcher/type ::signup/signup=>
:dispatcher/component #'signup/SignupPage}]])
;; revisions to users schema
{:db/ident :user/emails
:attr/label "User emails"
:db/doc "All emails for a given user"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:attr/migration "migration.users"}
{:db/ident :email/address
:attr/label "Email address"
:db/doc "Actual email address"
:db/valueType :db.type/string
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one
:attr/migration "migration.users"}
{:db/ident :email/code
:attr/label "Confirmation code"
:db/doc "Secure confirmation code for this email"
:db/valueType :db.type/uuid
:db/uniqueness :db.unique/identity
:db/cardinality :db.cardinality/one
:attr/migration "migration.users"}
{:db/ident :email/confirmed-at
:attr/label "Confirmed at"
:db/doc "When this email was confirmed"
:db/valueType :db.type/instant
:db/cardinality :db.cardinality/one
:attr/migration "migration.users"}
(def
^{:doc "Schema for invitations"}
invitations
(with-meta
[{:db/id "migration.invitations"
:migration/key :bread.migration/invitations
:migration/description "Migration for invitations to sign up"}
{:db/ident :invitation/email
:attr/label "Invitation email"
:db/doc "Email this invitation was sent to, if any"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:attr/migration "migration.invitation"}
{:db/ident :invitation/redeemed-at
:attr/label "Redeemed at"
:db/doc "When this invitation was redeemed"
:db/valueType :db.type/instant
:db/cardinality :db.cardinality/one
:attr/migration "migration.invitation"}
{:db/ident :invitation/code
:attr/label "Invitation code"
:db/doc "Secure UUID for this invitation"
:attr/sensitive? true
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:attr/migration "migration.invitation"}
{:db/ident :invitation/invited-by
:attr/label "Invited by"
:db/doc "User who created this invitation"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:attr/migration "migration.invitation"}]
{:type :bread/migration
:migration/dependencies #{:bread.migration/migrations
:bread.migration/things
:bread.migration/users}}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment