Skip to content

Instantly share code, notes, and snippets.

@philschmid
Last active September 8, 2019 14:39
Show Gist options
  • Save philschmid/54a4b655840ca34f12f17b284e0b0229 to your computer and use it in GitHub Desktop.
Save philschmid/54a4b655840ca34f12f17b284e0b0229 to your computer and use it in GitHub Desktop.
job-amplify-schema
# @format
# cognito user needs
# - coginto:groups
# - coginto:name
# - coginto:userName || coginto:custom:id (uuid)
# - coginto:name
# - coginto:custom:userCompany
# - coginto:custom:department
# cognito groups (with userCompanyId) should be filled after signUP either by the existing companyId as group through a license-key
# or through an new generated license-key for a new created company
# value of cognito:groups === userCompanyId(uuid)
# this allows it to change the license-key of an company and groups if there is an leak
type Job
@model
@auth(rules: [
{ allow: owner },
{ allow: owner, ownerField: "readers", operations: [read]},
{ allow: groups, groupsField: "accessGroup", operations: [create, update, read] }
])
@key(fields: ["userCompanyId", "userCompany", "department","startDate","SearchCompany"])
# fields[0] => Hashkey
# fields[1 ... n] = fields[1]#fields[2]#fields[3] => RangeKey
{
userCompanyId: string! #setDefault by frontend with value from cognito:groups out of jwt
userId: String! #setDefault by cognito either through custom:uuid oder userName
userCompany: String!, #setDefault by frontend with value from cognito custom:userCompany out of jwt
employee: String, #setDefault by frontend with value from cognito:name out of jwt
department: String, #setDefault by frontend with value from cognito custom:department out of jwt
startDate: AWSDateTime!, #setDefault by frontend new Date()
endDate: AWSDateTime!, #setDefault by frontend new Date()
searchCompany: String!,
type: string,
apis: [Api]!,
nlpModules:[String]!,
intervall: Int,
createdAt: AWSDateTime! #setDefault new Date()
accessGroup: [String]! #setDefault by frontend with value from cognito:groups out of jwt
}
type Api {
GoogleNews: AWSDateTime!
FocusNews: AWSDateTime!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment