schultek / stormberry

Access your postgres database effortlessly from dart code.
https://pub.dev/packages/stormberry
MIT License
68 stars 17 forks source link

HiddenIn & ViewedIn syntax #57

Open stepanzalis opened 1 year ago

stepanzalis commented 1 year ago

Hey! First, I would like to thank you for your package, so far I really like it. I currently struggle with @HiddenIn and @ViewedIn syntax. Let's say I have following entities:

Example:

@Model(views: [...])
abstract class Project {
  List<Task> get tasks;
}

Project has many tasks:

@Model(views: [...])
abstract class Task {
  Project get project;
  List<Subtask> get subtasks;
}

and access to subtasks (for example from Task entity I need to show how many subtasks are in there.

@Model(views: [..])
abstract class Subtask {
  Task get task;
}

Problem:

I don't understand the @HiddenIn & @ViewedIn syntax in order not to get cyclic dependencies. Can you please provide me example how to add the Views in order to get List<Task> from Project andList<Subtask> from Task? Thanks!

schultek commented 1 year ago

Thanks.

Did you have a look at the example? What exactly is unclear?

Generally I know its quite hard to get and I'm also not really happy with the system right now, but I couldn't figure out a better way yet. If you have some pointers I'm happy to try and improve it.