Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation of auth guard,backend logic for reminder,trash #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 84 additions & 1 deletion RecollectApp/Backend/Routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ router.post("/addNewNote" , (req,res,next) => {
title: req.body.title,
details: req.body.details,
placeholderTitle: req.body.placeholderTitle,
placeholder: req.body.placeholder
placeholder: req.body.placeholder,
reminder: req.body.reminder,
draft: req.body.draft,
trash: req.body.trash

});
console.log(' signup method occured.. 2');
Expand Down Expand Up @@ -165,7 +168,87 @@ router.post("/loginOne", (req, res) => {
});



router.put("/updatereminder/:id",(req,res,next)=>{
console.log("inside get all note data function");
console.log("id = "+ req.params.id);
const noteData = new Note({
_id : req.params.id,
userId: req.body.userId,
indexPosition: req.body.indexPosition,
title: req.body.title,
details: req.body.details,
placeholderTitle: req.body.placeholderTitle,
placeholder: req.body.placeholder,
reminder: req.body.reminder,
draft: req.body.draft,
trash: req.body.trash

});

Note.updateOne({_id : req.params.id},noteData).
then(result=>{

res.status(201).json({
message: "user update remainder successfully",
result:result,

});





});
});




//// get Draft Data

router.get("/getDraftNoteData/:id",(req,res,next)=>{
console.log("inside get all note data function");
console.log("id = "+ req.params.id);
Note.find({userId : req.params.id, draft:1,reminder:0,trash:0}).
then(documents => {
console.log("NoteData = "+documents);
res.json(
documents
);
});
});


//// get Reminder Data

router.get("/getReminderNoteData/:id",(req,res,next)=>{
console.log("inside getReminderNoteData note data function");
console.log("id = "+ req.params.id);
Note.find({userId : req.params.id, draft:0,reminder:1,trash:0}).
then(documents => {
console.log("NoteData = "+documents);
res.json(
documents
);
});
});


//// get Trash Data

router.get("/getTrasheData/:id",(req,res,next)=>{
console.log("inside get all note data function");
console.log("id = "+ req.params.id);
Note.find({userId : req.params.id, draft:0,reminder:0,trash:1}).
then(documents => {
console.log("NoteData = "+documents);
res.json(
documents
);
});
});



module.exports = router;
5 changes: 4 additions & 1 deletion RecollectApp/Backend/models/notedata.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ const userSchema = mongoose.Schema({
details: { type: String, required: true },
placeholderTitle: { type: String, required: true },
placeholder: { type: String, required: true },
reminder: { type: Number, required: true },
draft: { type: Number, required: true },
trash: { type: Number, required: true }




});

module.exports = mongoose.model("tbl_note_data", userSchema);
module.exports = mongoose.model("noteSchema", userSchema);



Expand Down
2 changes: 1 addition & 1 deletion RecollectApp/Backend/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const userSchema = mongoose.Schema({

});

module.exports = mongoose.model("tbl_user_basic_data", userSchema);
module.exports = mongoose.model("userSchema", userSchema);



Expand Down
2 changes: 1 addition & 1 deletion RecollectApp/Backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use((req, res, next) => {
);
res.setHeader(
"Access-Control-Allow-Methods",
"GET, POST, PATCH, DELETE, OPTIONS"
"GET, POST, PATCH, DELETE, OPTIONS, PUT "
);
next();
});
Expand Down
15 changes: 0 additions & 15 deletions RecollectApp/src/app/Pages/main-layout/main-layout.component.html

This file was deleted.

37 changes: 0 additions & 37 deletions RecollectApp/src/app/Pages/main-layout/main-layout.component.scss

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions RecollectApp/src/app/Pages/main-layout/main-layout.component.ts

This file was deleted.

28 changes: 0 additions & 28 deletions RecollectApp/src/app/Pages/notes-list/notes-list.component.html

This file was deleted.

28 changes: 0 additions & 28 deletions RecollectApp/src/app/Pages/notes-list/notes-list.component.scss

This file was deleted.

42 changes: 0 additions & 42 deletions RecollectApp/src/app/Pages/notes-list/notes-list.component.ts

This file was deleted.

8 changes: 5 additions & 3 deletions RecollectApp/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';

import { MainLayoutComponent } from './Pages/main-layout/main-layout.component';
import { NotesListComponent } from './Pages/notes-list/notes-list.component';

const routes: Routes = [
{
Expand All @@ -16,7 +15,10 @@ const routes: Routes = [
loadChildren: () =>
import('./home/home.module').then((m) => m.HomeModule),
},

{
path : '**',
component:PageNotFoundComponent
}

/* {path : '' , component: LoginComponent},
{path : 'login' , component: LoginComponent},
Expand Down
8 changes: 2 additions & 6 deletions RecollectApp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HeaderComponent } from './header/header.component';

import { MainLayoutComponent } from './Pages/main-layout/main-layout.component';
import { NotesListComponent } from './Pages/notes-list/notes-list.component';
import { FormsModule } from '@angular/forms';
import{ HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { AuthInterceptor } from './auth-interceptor';
import { ErrorInterceptor } from './error-interceptor';
import { ErrorPopupComponent } from './error-popup/error-popup.component';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';



@NgModule({
declarations: [
AppComponent,
HeaderComponent,

MainLayoutComponent,
NotesListComponent,
ErrorPopupComponent,
PageNotFoundComponent,


],
Expand Down
Loading