Skip to content
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

Setting field type as type/interface #276

Open
mihaa1 opened this issue Oct 22, 2023 · 2 comments
Open

Setting field type as type/interface #276

mihaa1 opened this issue Oct 22, 2023 · 2 comments

Comments

@mihaa1
Copy link

mihaa1 commented Oct 22, 2023

Is it possible to set a field type in an entity to be a custom type or interface I created?

@noam-honig
Copy link
Collaborator

noam-honig commented Oct 23, 2023

Hi @mihaa1

Sure, you can user Field.Json or Field.Object if your db doesn't support json well
https://remult.dev/docs/field-types.html#json-field

@mihaa1
Copy link
Author

mihaa1 commented Oct 23, 2023

Hi @mihaa1

Sure, you can user Field.Json or Field.Object if your db doesn't support json well https://remult.dev/docs/field-types.html#json-field

This is what I'm doing:

interface Settings {
  shiftLengthHrs: ShiftLength;
}

@Fields.json()
  settings: Settings = {
    shiftLengthHrs: 1,
  };

Is this the recommended way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants