-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from sparcs-kaist/develop
Deploy
- Loading branch information
Showing
39 changed files
with
2,338 additions
and
1,581 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:16-alpine | ||
FROM node:18.18.2-alpine | ||
|
||
|
||
RUN apk add --no-cache git | ||
|
This file contains 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 contains 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 contains 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 contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:16-alpine | ||
|
||
|
||
RUN apk add --no-cache git | ||
|
||
WORKDIR '/app' | ||
|
||
COPY ./package.json ./ | ||
COPY ./yarn.lock ./ | ||
RUN yarn | ||
|
||
COPY . . | ||
|
||
CMD ["node", "worker.js"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require ('@babel/register'); | ||
require ('../config/env'); | ||
|
||
const {Zabo} = require('../src/db'); | ||
|
||
/** | ||
* Make any changes you need to make to the database here | ||
*/ | ||
async function up () { | ||
// Write migration here | ||
// eslint-disable-next-line no-restricted-syntax | ||
for await (const zabo of Zabo.find()) { | ||
zabo.showBoard = false; | ||
await zabo.save (); | ||
} | ||
} | ||
|
||
/** | ||
* Make any changes that UNDO the up function side effects here (if possible) | ||
*/ | ||
async function down () { | ||
// Write migration here | ||
} | ||
|
||
module.exports = { up, down }; |
This file contains 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 contains 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 contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Components } from "../components"; | ||
|
||
export const addDeviceAction = { | ||
actionType: "resource", | ||
component: Components.addDeviceComponent, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import axios from "axios"; | ||
export const deleteDeviceAction = { | ||
actionType: "record", | ||
component: false, | ||
guard: "Do you really want to delete this device?", | ||
handler: async (req, res, context) => { | ||
const { record } = context; | ||
const deviceName = record.params.name; | ||
const response = await axios.delete("/api/board/device", { | ||
name: deviceName, | ||
}); | ||
|
||
response.data.message; | ||
|
||
return { | ||
record: {}, | ||
msg: "Deleting Device: Success", | ||
}; | ||
}, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, {useState} from 'react' | ||
import { H3, Input, Button } from '@adminjs/design-system'; | ||
import axios from 'axios'; | ||
|
||
const addDevice = async (name, description, password) => { | ||
const response = await axios.post('/api/board/device', | ||
{ | ||
name, | ||
description, | ||
password | ||
} | ||
); | ||
} | ||
|
||
const addDeviceComponent = (props) => { | ||
const [name, setName] = useState(""); | ||
const [description, setDescription] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
|
||
const handleNameChange = (e) => { | ||
setName(e.target.value); | ||
} | ||
|
||
const handleDescriptionChange = (e) => { | ||
setDescription(e.target.value); | ||
} | ||
|
||
const handlePasswordChange = (e) => { | ||
setPassword(e.target.value); | ||
} | ||
|
||
const handleDeviceSubmit = async() => { | ||
await addDevice(name, description, password); | ||
} | ||
|
||
return ( | ||
<div> | ||
<H3> Create your zabo boards device</H3> | ||
<br/> | ||
<Input type="text" onChange={handleNameChange} placeholder="name" /> | ||
<br/> | ||
<Input type="text" onChange={handleDescriptionChange} placeholder="description" /> | ||
<br/> | ||
<Input type="password" onChange={handlePasswordChange} placeholder="password" /> | ||
<br/> | ||
<Button size="icon" rounded="True" onClick={handleDeviceSubmit}>Submit</Button> | ||
</div> | ||
) | ||
} | ||
|
||
export default addDeviceComponent |
This file contains 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 contains 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 contains 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 contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Device } from "../../db/index"; | ||
import { addDeviceAction } from "../actions/addDevice"; | ||
|
||
export const DeviceResource = { | ||
resource: Device, | ||
options: { | ||
actions: { | ||
addDevice: addDeviceAction, | ||
}, | ||
}, | ||
}; |
This file contains 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 contains 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
Oops, something went wrong.