You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for creating the framework called elysia.
There is one thing I would like to confirm while using it, so I asked a question.
This is a matter regarding model settings.
Even though the Model is written as described in the Document, the Password is not Omited.
Should we do this...?
I would appreciate it if you could give me some advice when you have time.
The model is defined as below.
import{Elysia,Static,t}from'elysia';constaccount=t.Object({id: t.String({description: 'A unique identifier for the account',default: crypto.randomUUID(),}),name: t.String({default: 'anonymous',}),email: t.String({format: 'email',default: '[email protected]',error: 'email must be a valid email address',}),password: t.String({maxLength: 100,minLength: 8,default: crypto.randomUUID(),error: 'Password must 8 to 100 count',}),role: t.Union([t.Literal('admin',{description: 'admin grant'}),t.Literal('customer',{description: 'customer grant'})],{default: 'customer',error: 'role choose one , admin or customer',}),createdAt: t.Date({default: newDate()}),updatedAt: t.Date({default: newDate()}),});/** Basic Model */exporttypeAccount=Static<typeofaccount>;constOIdCreatedAtUpdatedAtAccount=t.Omit(account,['id','createdAt','updatedAt']);constOPIdCreatedAtUpdatedAtAccount=t.Composite([t.Omit(OIdCreatedAtUpdatedAtAccount,['role']),t.Partial(t.Pick(OIdCreatedAtUpdatedAtAccount,['role']),['role']),]);exporttypeCreateAccount=Static<typeofOPIdCreatedAtUpdatedAtAccount>;constOPasswordAccount=t.Omit(account,['password']);exporttypeOmitAccount=Static<typeofOPasswordAccount>;exportconstaccountModel=newElysia().model({'account.create': OPIdCreatedAtUpdatedAtAccount,'account.return': OPasswordAccount,});
route.ts
I'm sorry to share the specific implementation as is, but I would appreciate it if you could check the model settings mainly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First of all, thank you for creating the framework called elysia.
There is one thing I would like to confirm while using it, so I asked a question.
This is a matter regarding model settings.
Even though the Model is written as described in the Document, the Password is not Omited.
Should we do this...?
I would appreciate it if you could give me some advice when you have time.
Beta Was this translation helpful? Give feedback.
All reactions