Skip to content

Commit

Permalink
Read operations transferred (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyumat committed Jan 8, 2023
1 parent 0e6a4d7 commit 2758b3f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 31 deletions.
27 changes: 0 additions & 27 deletions backend/routes/crud/read/get_machines.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Router } from "express";
import { Dixon } from "../../../models/dixon.js";
import Dixon from "../../../models/dixon.js";
const router = Router();

router.get("/", async (req, res) => {
try {
let dixon = await Dixon.find({}).exec();
let machines = [];
let machines: any[] = [];
dixon.map((machine) => {
machines.push({
machine_name: machine.machine_name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { User } from "../../../models/user.js";
import { Router } from "express";
import User from "../../../models/user.js";
const router = Router();

router.get("/", async (req, res) => {
const username = req.query.username;
try {
let user = await User.findOne({ username: username }).exec();

if (!user) {
return res.status(400).json({ msg: "User does not exist." });
}

return res.status(200).json({
msg: `User ${user.username} found successfully!`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { User } from "../../../models/user.js";
//@ts-nocheck
import User from "../../../models/user.js";
import { Router } from "express";
const router = Router();

Expand Down

0 comments on commit 2758b3f

Please sign in to comment.