Copy amplify push --iterative-rollback #to rollback the last-known-good state
amplify push --force #rollback the last-known-good state and try redeploying your changes again using.
AWS Types: AWSDate | AWSTime | AWSDateTime | AWSTimestamp | AWSEmail | AWSJSON | AWSPhone | AWSURL | AWSIPAddress
Copy type Post @model {
id: ID!
title: String!
comments: [Comment] @hasMany
}
type Comment @model {
id: ID!
content: String!
}
Copy type StoryLike @model @auth(rules: [{ allow: public }]) {
userId: String! @primaryKey(sortKeyFields: ["storyId"])
user: User @hasOne(fields: ["userId"])
storyId: String!
story: Story @hasOne(fields: ["storyId"])
createdAt: String!
updatedAt: String!
}
Copy type Ranking @model @auth(rules: [{ allow: public }]) {
id: String! @primaryKey
type: String!
@index(name: "ByTypeStatus", sortKeyFields: ["status"], queryField: "rankingByTypeStatus")
userId: String!
@index(name: "ByUserStatus", sortKeyFields: ["status"], queryField: "rankingByUserStatus")
user: User @hasOne(fields: ["userId"])
rank: Int! @default(value: "0")
lastRank: Int
status: String!
createdAt: String!
updatedAt: String!
}
Copy import { API } from 'aws-amplify';
import { ThemesByEnabledQuery, Theme } from '../../API';
import { themesByEnabled } from '../../graphql/queries';
async function getEnabledThemes(): Promise<Theme[] | null> {
console.log('getting enabled themes');
try {
const response = (await API.graphql({
query: themesByEnabled,
variables: {
enabled: 1,
},
})) as { data: ThemesByEnabledQuery };
const data = response.data.themesByEnabled;
if (!data) {
throw new Error('Data was null');
}
return data.items ?? null;
} catch (err) {
console.error('Failed to get enabled themes', err);
return null;
}
}
export default getEnabledThemes;