Skip to content

Commit

Permalink
mongo db added to bakcend
Browse files Browse the repository at this point in the history
  • Loading branch information
sasanqc committed Jun 25, 2023
1 parent 723921f commit d44b114
Show file tree
Hide file tree
Showing 10 changed files with 687 additions and 45 deletions.
11 changes: 11 additions & 0 deletions components/UI/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import LoadingIcon from "@/icons/icon-loading.svg";
const Spinner = () => {
return (
<div role="status" className="w-10 h-10 fixed bottom-10 right-10">
<LoadingIcon className="text-primary2 w-8 h-8 mr-2 animate-spin fill-white anima" />
</div>
);
};

export default Spinner;
7 changes: 7 additions & 0 deletions database/connectMongo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import mongoose from "mongoose";
const connectMongo = async () =>
mongoose.connect(
process.env.DB || "mongodb://localhost:27017/kanban-web-app",
{ useNewUrlParser: true }
);
export default connectMongo;
25 changes: 25 additions & 0 deletions database/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import mongoose from "mongoose";
const { Schema, models } = mongoose;
const dataSchema = new Schema({
boards: [
{
name: String,
columns: [
{
name: String,
tasks: [
{
title: String,
description: String,
status: String,
subtasks: [{ title: String, isCompleted: Boolean }],
},
],
},
],
},
],
});
const BoardsModel =
models.BoardsModel || mongoose.model("BoardsModel", dataSchema);
export default BoardsModel;
4 changes: 4 additions & 0 deletions icons/icon-loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d44b114

Please sign in to comment.