Hi guys,
I play with Custom Entity Store, no error, but nothing in the Storage, nothing in the query
Some parts of my code :
Manifest
Btw : i use “issue”, “test1” is the previous test
type or paste code storage:
entities:
- name: issue
attributes:
id:
type: string
summary:
type: string
status:
type: string
createdDate:
type: string
indexes:
- status
- createdDate
- name: "by-status"
range:
- status
partition:
- status
- name: "by-status-createdDate"
range:
- createdDate
partition:
- status
- name: test1
attributes:
component:
type: string
product:
type: string
scope:
type: string
team:
type: string
bu:
type: string
indexes:
- name: "by-component"
range:
- component
partition:
- component
- name: "by-product"
range:
- product
partition:
- product
- name: "by-scope"
range:
- scope
partition:
- scope
- name: "by-team"
range:
- team
partition:
- team
- name: "by-bu"
range:
- bu
partition:
- buhere
The webtrigger async
...
const getIssueById = async (id) => {
return await storage.entity("issue").get(id);
};
const getIssues = async (status) => {
const results = await storage.entity("issue").query()
.index("by-status", {
partition: ["status"]
})
.limit(2)
.getMany();
};
const getIssuesByStatus = async (status) => {
const results = await storage.entity("issue").query()
.index("by-status", {
partition: ["status"]
})
.where(WhereConditions.equalsTo('Close'))
.limit(2)
.getMany();
return results;
};
exports.runAsync = async (request) => {
try {
const issue1 = {
id: 'ISSUE-120',
summary: 'Issue summary',
status: 'Close',
createdDate: '2024-07-18'
};
await storage.entity("issue").set(issue1.id, issue1);
const issue2 = {
id: 'ISSUE-121',
summary: 'Issue summary',
status: 'Close',
createdDate: '2024-07-18'
};
await storage.entity("issue").set(issue2.id, issue2);
const issue3 = {
id: 'ISSUE-122',
summary: 'Issue summary',
status: 'Close',
createdDate: '2024-07-18'
};
await storage.entity("issue").set(issue3.id, issue3);
const issue4 = {
id: 'ISSUE-123',
summary: 'Issue summary',
status: 'Close',
createdDate: '2024-07-18'
};
await storage.entity("issue").set(issue4.id, issue4);
const issue1FromStorage = await getIssueById('ISSUE-121');
console.log("getIssueById: " + JSON.stringify(issue1FromStorage));
const issue3FromStorage = await getIssueById('ISSUE-123');
console.log("getIssueById: " + JSON.stringify(issue3FromStorage));
const issues = await getIssues();
console.log("issues: " + JSON.stringify(issues));
const issuesByStatus = await getIssuesByStatus('Open');
console.log("openIssues: " + JSON.stringify(issuesByStatus));
....
Storage is empty. Is there an other Storage for Custom Entity? and this one is dedicated for simple key/value?
My Logs
Looks like the storage.set is OK, i can Get the value even there is nothing is the Developer Storage.
My query test doesn’t bug, but result is empty.
Any ideas?
Regards.