Skip to content

Commit

Permalink
Feat/data fetcing (#34)
Browse files Browse the repository at this point in the history
* Updates to data fetching

* Update coaching stuff

* Adding sleep view

* Add react table

* Sleep chart

* Changes from other projects

* Amplify stuff

* Sleep points

* Git ignore + missing translation

* Change to production deployments

* Remove meta files

* Remove data view
  • Loading branch information
plahteenlahti authored Sep 15, 2020
1 parent b29a94d commit 52dfa19
Show file tree
Hide file tree
Showing 39 changed files with 4,911 additions and 506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: ambientlight/amplify-cli-action@0.2.1
with:
amplify_command: configure
amplify_env: dev
amplify_env: production
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ build/
dist/
aws-exports.js
amplify/team-provider-info.json
amplify/backend/api
amplify/backend/auth
amplify/backend/api/nyxodev/build
amplify/backend/api/nyxodev/resolvers
amplify/backend/api/nyxodev/stacks
amplify/backend/hosting
amplify/backend/amplify-meta
awsconfiguration.json
amplifyconfiguration.json
amplify-build-config.json
amplify-gradle-config.json
amplifyxc.config

amplify/backend/function/nyxoPoints/src/amplify/backend/amplify-meta.json
amplify/backend/function/nyxoPoints/src/amplify/#current-cloud-backend/amplify-meta.json
.env*
.secrets
11 changes: 11 additions & 0 deletions amplify/backend/api/nyxoDev/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"AppSyncApiName": "nyxoDev",
"DynamoDBBillingMode": "PAY_PER_REQUEST",
"DynamoDBEnableServerSideEncryption": "false",
"AuthCognitoUserPoolId": {
"Fn::GetAtt": [
"authnyxodev",
"Outputs.UserPoolId"
]
}
}
327 changes: 327 additions & 0 deletions amplify/backend/api/nyxoDev/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
type SleepData
@model
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{
allow: owner
ownerField: "viewers"
mutations: null
queries: [get, list]
}
]
) {
id: ID!
userId: ID!
user: User! @connection(fields: ["userId"])
date: String!
rating: Int
night: [NightSegment]
}

type NightSegment {
value: String!
sourceName: String!
sourceId: String!
startDate: String!
endDate: String!
}

type Request
@model
@auth(
rules: [
{
allow: owner
ownerField: "owner"
mutations: [create]
queries: [get, list]
}
{
allow: owner
ownerField: "userId"
mutations: [delete, update]
queries: [get, list]
}
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
]
) {
id: ID!
requesterName: String!
requesterId: String!
userName: String!
userId: String!
accepted: Boolean!
}

type User
@key(
name: "byConnectionId"
fields: ["connectionId"]
queryField: "userByConnectionId"
)
@model
@auth(
rules: [
{
allow: owner
ownerField: "owner"
mutations: [update, delete]
queries: [get, list]
}
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{ allow: groups, groups: ["coach"], mutations: null, queries: [get, list] }
]
) {
connectionId: String
id: ID!
email: String!
nickname: String
darkMode: Boolean
intercomId: String
activeCoaching: CoachingData @connection(name: "ActiveCoachingMonth")
sleepPoints: SleepPoints
}

type SleepPoints {
efficiency: Int
duration: Int
socialJetLag: Int
timing: Int
}

type CoachingData
@key(name: "byUser", fields: ["userId"], queryField: "coachingByUser")
@model
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{
allow: owner
ownerField: "viewers"
mutations: null
queries: [get, list]
}
]
) {
id: ID!
userId: ID!
user: User! @connection(fields: ["userId"])
stage: Stage
active: User @connection(name: "ActiveCoachingMonth")
activeWeek: String
started: String
ended: String
weeks: [Week]
lessons: [String]
}

enum Stage {
ONGOING
PAUSED
COMPLETED
}

type Week {
started: String
ended: String
locked: Boolean
slug: String
}

type Habit
@model
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{
allow: owner
ownerField: "viewers"
mutations: null
queries: [get, list]
}
]
) {
id: ID!
userId: ID!
user: User! @connection(fields: ["userId"])
dayStreak: Int
longestDayStreak: Int
latestCompletedDate: String
title: String!
description: String
date: String!
days: [DayCompletionRecord]!
archived: Boolean
period: Period!
}

enum Period {
morning
afternoon
evening
}

type DayCompletionRecord {
key: String
value: Int
}

type Night
@model
@aws_iam
@auth(
rules: [
{ allow: owner }
{ allow: private, provider: iam, operations: [read] }
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{
allow: owner
ownerField: "viewers"
mutations: null
queries: [get, list]
}
]
) {
id: ID!
userId: ID!
user: User! @connection(fields: ["userId"])
sourceId: String!
sourceName: String!
value: NightValue!
startDate: String!
endDate: String!
totalDuration: Int!
}

enum NightValue {
InBed
Asleep
Awake
}

type LikedContent
@model
@key(name: "bySlug", fields: ["slug", "id"], queryField: "likedContentBySlug")
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete, update, create]
queries: [get, list]
}
]
) {
id: ID!
name: String
type: String
slug: String
}

type NightRating
@model
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete]
queries: [get, list]
}
{
allow: owner
ownerField: "viewers"
mutations: null
queries: [get, list]
}
]
) {
id: ID!
userId: ID!
user: User! @connection(fields: ["userId"])
rating: Int!
date: String!
}

type FeedbackContent
@model
@key(
name: "bySlug"
fields: ["slug", "id"]
queryField: "feedbackContentBySlug"
)
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete, update, create]
queries: [get, list]
}
]
) {
id: String
type: String
slug: String!
rating: Int!
}

type Comments
@model
@key(name: "bySlug", fields: ["slug", "id"], queryField: "commentsBySlug")
@auth(
rules: [
{ allow: owner }
{
allow: groups
groups: ["admin"]
mutations: [delete, update, create]
queries: [get, list]
}
]
) {
id: String
type: String
slug: String!
firstName: String
lastName: String
guest: Boolean
comment: String!
}
7 changes: 7 additions & 0 deletions amplify/backend/api/nyxoDev/transform.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Version": 4,
"ElasticsearchWarning": true,
"StackMapping": {
"QueryfeedbackContentBySlugResolver": "FeedbackContent"
}
}
Loading

0 comments on commit 52dfa19

Please sign in to comment.