-
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 #144 from sparcs-kaist/feature/board
Zabo boards 서비스 관련 API 작업
- Loading branch information
Showing
24 changed files
with
2,090 additions
and
1,572 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
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,5 +1,6 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
.uuid | ||
# dependencies | ||
/node_modules | ||
|
||
|
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 @@ | ||
a957a967-540e-49b2-b11a-17f32887ba0f |
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
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, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.