We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to use typedItems with a one-to-many relationship? For example, a project entity with the relationship "has a" expert
@freezed class ProjectDto with _$ProjectDto implements IIdentifable { const ProjectDto._(); // Added constructor fro my own methods const factory ProjectDto({ required int id, required String name, required ExpertDto expert, }) = _ProjectDto; factory ProjectDto.fromJson(Map<String, dynamic> json) => _$ProjectDtoFromJson(json); }
Currently the code below doesn't work because expert is an "int" and not my expert fields.
class ProjectRepository extends BaseRepository { static const String collection = "project"; Future<List<ProjectDto>> getProjectsAsync() async { final result = await executeQueryConverterAsync(collection, ProjectDtoConverter()); return result; } } class ProjectDtoConverter extends ItemsConverter<ProjectDto> { @override ProjectDto fromJson(Map<String, Object?> data) { return ProjectDto.fromJson(data); } @override Map<String, Object?> toJson(ProjectDto data) { return data.toJson(); } }
@override Future<List<E>> executeQueryConverterAsync<E>( String collection, ItemsConverter<E> converter) async { try { var result0 = await DirectusCoreSingleton.instance .typedItems(collection, converter: converter) .readMany(); return result0.data; } catch (e) { debugPrint(e.toString()); return []; } }
Is there a way to achieve my goals or is it not supported? If not, I'll have to make two requests and link them by hand, or attack GraphQL directly.
Thank you in advance for your advice and for this library.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is it possible to use typedItems with a one-to-many relationship?
For example, a project entity with the relationship "has a" expert
Currently the code below doesn't work because expert is an "int" and not my expert fields.
Is there a way to achieve my goals or is it not supported? If not, I'll have to make two requests and link them by hand, or attack GraphQL directly.
Thank you in advance for your advice and for this library.
The text was updated successfully, but these errors were encountered: