How to use guest() access to data in aws amplify gen2 ? While i have added the product as the owner, the product is not fetched while listing the products when i am not logged in. This is not working for me.
Product: a
.model({
name: a.string().required(),
description: a.string(),
price: a.float().required(),
image: a.string().required(),
categoryId: a.id(),
category: a.belongsTo('Category', 'categoryId'),
sellerId: a.id(),
seller: a.belongsTo('Profile', 'sellerId'),
status: a.enum(["active", "disabled"])
})
.authorization((allow) => [
allow.guest().to(["read"]),
allow.authenticated().to(['read']),
allow.owner().to(["create", "read", "update", "delete"])
]),
xport type Schema = ClientSchema<typeof schema>;
export const data = defineData({
schema,
authorizationModes: {
defaultAuthorizationMode: 'userPool',
apiKeyAuthorizationMode: {
expiresInDays: 30,
},
},
});