-
Hello! Thank you for wonderful product! My question is: For example: export default class Operator extends Model {
@HasMany(() => Ticket, "operator_id") declare tickets: Ticket[];
get ticket_count() {
return this.tickets?.length;
}
}
P.S. If I understand correctly, models are dumb and cannot be used for querying the data. const sortedOperators = computed(() => {
return operatorRepo.value
.with("tickets")
.orderBy("ticket_count", "desc")
.get();
}); But this works: const sortedOperators = computed(() => {
return useCollect(
operatorRepo.value.with("tickets").get()
).sortBy([["ticket_count", "desc"]]);
}); Am I doing it the right way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes you are doing it the right way. Also in |
Beta Was this translation helpful? Give feedback.
Yes you are doing it the right way. Also in
vuex-orn
you never could access relations because they are loaded to late. Maybe i try for v2. make this possible, but first i have to look into the code what this would mean.