Replies: 1 comment 2 replies
-
As a suggestion i would implement something like an method class Model {
...
static piniaStoreName
static piniaStoreNamePrefix
$piniaStoreName() {
return [this.$self().piniaStoreNamePrefix, this.$self().piniaStoreName || this.$baseEntity()].filter(v => v).join('/')
}
...
} class Query {
...
commit(name, payload) {
const store = useDataStore(this.model.$piniaStoreName(), this.model.$piniaOptions(), this)(this.pinia);
...
}
...
} class Repository {
...
piniaStore() {
return useDataStore(this.model.$piniaStoreName(), this.model.$piniaOptions(), this.query())(this.pinia);
}
...
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why does the Repository uses the
$entity()
as a name for the Pinia Store, while the Query uses the$baseEntity()
. Is this by design or by mistake?pinia-orm/packages/pinia-orm/src/repository/Repository.ts
Lines 117 to 119 in 43126f6
pinia-orm/packages/pinia-orm/src/query/Query.ts
Lines 163 to 172 in 43126f6
When creating a Model extended from an other Model we use baseEntity in the exteded Model.
When we use the following code, a store is created with the name
adult
But when we use the following code a store is created and data is saved into the piniaStoreInstance with the name
person
Beta Was this translation helpful? Give feedback.
All reactions