-
Notifications
You must be signed in to change notification settings - Fork 0
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
Antti | kirjautuminen ja rekistöröityminen sekä authentication #23
Conversation
…to handle registering. Added some basic handler functions there
…so credits can be given easier
…t middleware interfering. Most likely will be replaced / deleted, but it works for now in development stage
…rst name etc to make development easier and faster
…written multiple times
…st for user creation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Erinomaista työtä! Muutama kommentti vielä, mutta lähes valmista on 💪
pages/api/auth/register.ts
Outdated
const session = await lucia.createSession(userCreationRequest.uuid, { | ||
user: { | ||
connect: { | ||
uuid: userCreationRequest.uuid, | ||
}, | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En muistanut tuota User
-modelin linkitystä sessioon, kiitos hyvästä selvityksestä!! Relaatio on hyvä olla ja se vaatii parametrin.
Sitä jäin vielä miettimään, että olisiko selkeämpi tehdä näin:
const session = await lucia.createSession(userData.uuid, {
userUUID: userData.uuid,
});
Sitten jos vielä lisäisi backend/auth.ts
tiedostoon declare module 'lucia'
kohtaan lisäisi
DatabaseSessionAttributes: { userUUID: string };
niin typescript herjaisi jos tuon parametrin unohtaisi (nyt ei anna virhettä). Voisiko toimia?
Toinen on se, että tuo userUUID-kenttä näyttäisi olevan melko turha, koska se on täysin sama kuin userId. Eli molemmissa on käyttäjän UUID
Joo molempia kenttiä ei tarvita. userUUID
kenttä on kuvaavampi, kun kyseessä uuid, joten jos se ei aiheuta ongelmia niin poistaisin userId
kentän tarpeettomana.
pages/api/gifts/[uuid].ts
Outdated
AND: { | ||
user: { | ||
uuid: userData.uuid, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muistaakseni Prismassa AND
on oletuksena where
lausekkeessa, joten kokeilepa toimisiko tämä vähän yksinkertaisempi muoto:
AND: { | |
user: { | |
uuid: userData.uuid, | |
}, | |
}, | |
userUUID: userData.uuid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Näytti toimivan kun kokeilin! Hyvä löyty, selkeyttää huomattavasti koodia! Kiitos! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meikä on painanut hiukan liian kovalla kaasulla, kun tämäkin näköjään on jäänyt korjaamatta 😅
Tämä on siis korjattu ja kokeiltu, että toimii, vielä en pushannut sitä 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushaa vain niin saadaan korjaus mukaan 👍
const session = await lucia.createSession(userData.uuid, {
userUUID: userData.uuid,
}); tuo on paljon parempi tapa kuin se mitä itse käytin. Testailin tuon kanssa, eikä löytynyt mitään ongelmia, kiitos! 👍
Tuo Edit: ja vastasin tällä tavalla, koska en voinut suoraan kommentoida ehdotukseen 😄 |
…nect method while creating a session
Tähän committiin liittyen: 7e4a63a Voiko / kannattaako committeja tehdä enää sen jälkeen, kun on laittanut Nyt osa noista ideoista näkyy Esim tämä: #23 (comment) |
Voi tehdä ja kannattaa myös tehdä. Tuo |
Aivan, säilytetään sitten molemmat kentät. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taitaa olla enää tämä yksi kommentti ja sitten on valmista.
Jes, se on korjattu. Nyt pitäisi olla siis kaikki kunnossa 👍 |
Oho, painoin vahingossa "Close with comment":ia 😅 Mergeen sen nyt mainiin, kun nuo kaikki on korjattu 👍 |
Nousi pari kysymystä mieleen, joten ajattelin pushata ja kysyä ennenkuin lähtee isommin tekemään 😄