-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Problem with actions on database #1056
Comments
Hey @Mederick-ROBERT! 👋🏻 Can you please share your |
Yes of course, With the acces token guard : import { DateTime } from 'luxon'
import hash from '@adonisjs/core/services/hash'
import { compose } from '@adonisjs/core/helpers'
import { BaseModel, column } from '@adonisjs/lucid/orm'
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid'
import { DbAccessTokensProvider } from '@adonisjs/auth/access_tokens'
const AuthFinder = withAuthFinder(() => hash.use('scrypt'), {
uids: ['email'],
passwordColumnName: 'password',
})
export default class User extends compose(BaseModel, AuthFinder) {
@column({ isPrimary: true })
declare id: number
@column()
declare fullName: string | null
@column()
declare email: string
@column({ serializeAs: null })
declare password: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
static accessTokens = DbAccessTokensProvider.forModel(User)
} without the guard : import { DateTime } from 'luxon'
import { BaseModel, column } from '@adonisjs/lucid/orm'
export default class User extends BaseModel {
@column({ isPrimary: true })
declare id: number
@column()
declare fullName: string | null
@column()
declare email: string
@column({ serializeAs: null })
declare password: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
} |
I have the same issue with a similar User model. Only thing I changed is the prop name |
I got the same issue with db:seed. I wonder why it select from "user_with_user_finders" where it doesn't event exists.
|
Can you try to downgrade |
@RomainLanz yes it works. |
Downgrade to this version works. I had to manually replace in my lock file for some reason, but thats okay. ^_^ |
Future discussion will happen here. adonisjs/core#4759 |
Package version
21.2.0
Describe the bug
I started a new project with the API Starter Kit and access_tokens guard + a Postgres db.
I connect the db in
.env
file, realised migrations with success. After I create a new seeder for create a new user, I have this error :The seeder :
I test with the same things but without the
access token
guard and I have this new error :After that, I create a GET route with a json response for getting all users, and I get this error :
I don't know if it's a bug, or if I configured my project incorrectly
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: