0
I have the following model in my NextJs 13 app. I am using grafbase.
// @ts-ignore
const User = g
.model('User', {
name: g.string().length({ min: 2, max: 100
}).optional(),
email: g.string().unique(),
password: g.string().optional(),
active: g.boolean().optional(),
allowReset: g.boolean().optional(),
avatarUrl: g.url().optional(),
})
.auth((rules) => {
rules.public().read()
rules.private().create().delete().update()
})
// @ts-ignore
const ActivateToken = g
.model('ActivateToken', {
token: g.string().unique(),
activatedAt: g.datetime().optional(),
createdBy: g.relation(() => User),
})
.auth((rules) => {
rules.public().read()
rules.private().create().delete().update()
})
After a user is created and activated from an email I send to update the active state everything works fine.
If I delete the ActivateToken, the user no longer shows up in the ActiveTokenCollection, however the user is still in the database as if I search for the user by id it is show. Very strange issue.
If i don’t delete the tokens, everything is fine, but thinking about maintenance and not have loads of tokens I thought about deleting older, expired ones.
any ideas?
|