This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __CONFIG_H__ | |
#define __CONFIG_H__ | |
// GPIO pins for our buttons | |
#define CONFIG_PIN_BUTTON_1 32 | |
#define CONFIG_PIN_BUTTON_2 33 | |
#endif /* __CONFIG_H__ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from "express"; | |
import { Server } from "ws"; | |
import type { WebSocket } from "ws"; | |
import short from "short-uuid"; | |
const PORT = process.env.PORT || 3000; | |
const INDEX = "/index.html"; | |
// websocket object to keep track of all clients | |
const sockets: { [key: string]: WebSocket } = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Auth, API } from "aws-amplify"; | |
// ... | |
const id = "<some-clothe-id>"; | |
const myInit = { | |
headers: { | |
Authorization: `Bearer ${(await Auth.currentSession()) | |
.getIdToken() | |
.getJwtToken()}`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GraphQLClient = require("/opt/graphQLClient.js"); | |
const Q = require("/opt/graphql/queries.js"); | |
const M = require("/opt/graphql/mutations.js"); | |
/* -------------------------------------------------------------------------- */ | |
/* EXPORTS */ | |
/* -------------------------------------------------------------------------- */ | |
/** | |
* Deletes a clothe, its clothe images, and any corresponding outfit components. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /opt/graphql/queries.js | |
const listClotheImages = /* GraphQL */ ` | |
query listClotheImages( | |
$filter: ModelClotheImageFilterInput | |
$nextToken: String | |
) { | |
listClotheImages(filter: $filter, nextToken: $nextToken) { | |
items { | |
id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Clothe = require("./clothe.js"); | |
\\ ... | |
app.delete("/clothe/:clotheId", function (req, res) { | |
if (!req.headers["authorization"]) { | |
res.json({ success: false, error: "Not authenticated!" }); | |
} else if (!req.params.clotheId) { | |
res.json({ success: false, error: "No clothe ID parameter!" }); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Outfit | |
@model | |
@auth(rules: [{ allow: owner }]) { | |
components: [OutfitComponent!] @hasMany | |
} | |
type OutfitComponent | |
@model | |
@auth(rules: [{ allow: owner }]) { | |
clotheImage: ClotheImage! @belongsTo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk"); | |
const https = require("https"); | |
const UrlParse = require("url").URL; | |
const gql = require("graphql-tag"); | |
const graphql = require("graphql"); | |
const { print } = graphql; | |
/* | |
* Waits using an exponential | |
* backoff algorithm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is used to override the REST API resources configuration | |
import { AmplifyApiRestResourceStackTemplate } from "@aws-amplify/cli-extensibility-helper"; | |
export function override(resources: AmplifyApiRestResourceStackTemplate) { | |
// Add our user pool id as a parameter so we can create authorizers with it | |
// Note that you have to replace <your auth name here> with the name of your auth! | |
// It's the name of the folder in amplify/backend/auth that was created when you | |
// added the auth to the project (NOT userPoolGroups). Also make sure you keep | |
// the preceding "auth" part of the string before the auth name, it's necessary. | |
resources.addCfnParameter( |