-
Notifications
You must be signed in to change notification settings - Fork 0
Add files via upload #1
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
Open
Akanksha13-dev
wants to merge
3
commits into
main
Choose a base branch
from
Akanksha13-dev-patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
| [{ | ||
| "ID":"1", | ||
| "First__Name": "Akanksha", | ||
| "Middle__Name": "", | ||
| "Last__Name": "Singh", | ||
| "Email": "singh@gmail.com", | ||
| "Phone_Number": "9987654321", | ||
| "Role": 1, | ||
| "Address": "Bhopal", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "2", | ||
| "First__Name": "Jai", | ||
| "Middle__Name": "Narayan", | ||
| "Last__Name": "Singh", | ||
| "Email": "jns@gmail.com", | ||
| "Phone_Number": "9087654321", | ||
| "Role": 0, | ||
| "Address": "Pune", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "3", | ||
| "First__Name": "Shurabhi", | ||
| "Middle__Name": "Singh", | ||
| "Last__Name": "Mittal", | ||
| "Email": "ssm@gmail.com", | ||
| "Phone_Number": "8907654321", | ||
| "Role": 0, | ||
| "Address": "Mohali", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "4", | ||
| "First__Name": "Chavi", | ||
| "Middle__Name": "", | ||
| "Last__Name": "Sonali", | ||
| "Email": "ssp@gmail.com", | ||
| "Phone_Number": "8901234567", | ||
| "Role": 1, | ||
| "Address": "Mumbai", | ||
| "DateTime":"2020-2-3" | ||
| } | ||
|
|
||
| ] | ||
This file contains hidden or 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,158 @@ | ||
|
|
||
| enum Role{SuperAdmin,Admin,Subscriber}; | ||
| class model1{ | ||
| ID:number; | ||
| First__Name:string; | ||
| Middle__Name:string; | ||
| Last__Name:string; | ||
| Email:string; | ||
| Phone_Number:number; | ||
| Role:Role; | ||
| Address:string; | ||
| DateTime:string; | ||
| constructor(ID:number,First__Name:string,Middle__Name:string,Last__Name:string,Email:string,Phone_Number:number,Role:Role,Address:string,DateTime:string) | ||
| { | ||
| this.ID=ID; | ||
| this.First__Name=First__Name; | ||
| this.Middle__Name=Middle__Name; | ||
| this.Last__Name=Last__Name; | ||
| this.Email=Email; | ||
| this.Phone_Number=Phone_Number; | ||
| this.Role=Role; | ||
| this.Address=Address; | ||
| this.DateTime=DateTime; | ||
| } | ||
| } | ||
| let ListS=[]; | ||
| const obj1=new model1(1,'Akansha','fg','singh','singh@gmail.com',9876542123,Role.Admin,'adfghkk','2018-12-10T13:49:51.141Z'); | ||
| ListS.push(obj1); | ||
| const obj2=new model1(2,'Akriti','fg','singh','singh@gmail.com',7812345321,Role.Admin,'adfghkk','2018-12-10T13:49:51.141Z'); | ||
| ListS.push(obj2); | ||
| //API CALLS ====================================================================================== | ||
|
|
||
| async function getUsers() { | ||
|
|
||
| let response = await fetch('http://localhost:9000/exp22'); | ||
| let users = await response.json() as model1[] ; | ||
|
|
||
| return users; // same as Promise.resolve(users) | ||
|
|
||
| } | ||
| async function deleteUser(id: string) { | ||
|
|
||
| let response = await fetch(`http://localhost:9000/exp11/${id}`, { | ||
| method: 'DELETE' | ||
| }) | ||
| let data = await response.json() | ||
| return data; | ||
| } | ||
| async function editUser<model1>(id: string, object: model1) { | ||
|
|
||
| let response = await fetch(`http://localhost:9000/exp11/${id}`, { | ||
| method: 'PUT', | ||
| headers: { | ||
| 'Content-Type': 'application/json' | ||
|
|
||
| }, | ||
| body: JSON.stringify(object) | ||
| }) | ||
| let data = await response.json() | ||
| return data; | ||
| } | ||
| async function addUser<model1>(id: string, object: model1) { | ||
|
|
||
| let response = await fetch(`http://localhost:9000/exp11/${id}`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json' | ||
|
|
||
| }, | ||
| body: JSON.stringify(object) | ||
| }) | ||
| let data = await response.json() | ||
| return data; | ||
| } | ||
| //=================================================================================================== | ||
|
|
||
| interface list<T>{ | ||
| create(data:T):void; | ||
| read(r:number):void; | ||
| update(r:number):void; | ||
| delete(r:number):void; | ||
| } | ||
| class changeL implements list<model1>{ | ||
| create(data:model1):void{ | ||
| const row=new model1(data.ID,data.First__Name,data.Middle__Name,data.Last__Name,data.Email,data.Phone_Number,data.Role,data.Address,data.DateTime); | ||
| ListS.push(row); | ||
| } | ||
| read(r:number):void{ | ||
| var li=[]; | ||
|
|
||
| for (var j = 0; j < col.length; j++) { | ||
| var s=document.getElementById(col[j]+(r)).innerHTML; | ||
| //document.getElementById(j).value=""; | ||
| li.push(s); | ||
| } | ||
| let per={'ID':li[0],'First__Name':li[1],'Middle__Name':li[2], | ||
| 'Last__Name':li[3], | ||
| 'Email':li[4], | ||
| 'Phone_Number':li[5], | ||
| 'Role':li[6], | ||
| 'Address':li[7], | ||
| 'DateTime':li[8] } | ||
| document.getElementById('retriveValue').innerHTML=JSON.stringify(per); | ||
| document.getElementById("select"+r+"").style.visibility ="visible"; | ||
| document.getElementById("retrive"+r+"").style.visibility ="hidden"; | ||
| document.getElementById("update"+r+"").style.visibility ="hidden"; | ||
| document.getElementById("delete"+r+"").style.visibility ="hidden"; | ||
| document.getElementById("row"+r+"").style.backgroundColor = "white"; | ||
|
|
||
| } | ||
|
|
||
| update(no:number){ | ||
|
|
||
| document.getElementById("update"+no).style.visibility="hidden"; | ||
| document.getElementById("saveUpdate"+no).style.visibility="visible"; | ||
| document.getElementById("cancelUpdate"+no).style.visibility="visible"; | ||
|
|
||
| var Id=document.getElementById("ID"+no); | ||
| var FirstName=document.getElementById("First__Name"+no); | ||
| var MiddleName=document.getElementById("Middle__Name"+no); | ||
| var LastName=document.getElementById("Last__Name"+no); | ||
| var email =document.getElementById("Email"+no) ; | ||
| var Phone_N =document.getElementById("Phone_Number"+no) ; | ||
| var role =document.getElementById("Role"+no) ; | ||
| var address =document.getElementById("Address"+no) ; | ||
| var date =document.getElementById("DateTime"+no) ; | ||
|
|
||
| var ID=Id.innerHTML; | ||
| var FName=FirstName.innerHTML; | ||
| var MName=MiddleName.innerHTML; | ||
| var LName=LastName.innerHTML; | ||
| var Email=email.innerHTML; | ||
| var Phone=Phone_N.innerHTML; | ||
| var Role=role.innerHTML; | ||
| var Address=address.innerHTML; | ||
| var Date=date.innerHTML; | ||
|
|
||
| helpCancel(ID,FName,MName,LName,Email,Phone,Role,Address,Date); | ||
| Id.innerHTML="<input type='text' id='ID_"+no+"' value='"+ID+"'/>"; | ||
| FirstName.innerHTML="<input type='text' id='First_Name"+no+"' value='"+FName+"'/>"; | ||
| MiddleName.innerHTML="<input type='text' id='Middle_Name"+no+"' value='"+MName+"'/>"; | ||
| LastName.innerHTML="<input type='text' id='Last_Name"+no+"' value='"+LName+"'/>"; | ||
| email.innerHTML="<input type='text' id='Email_"+no+"' value='"+Email+"'/>"; | ||
| Phone_N.innerHTML="<input type='text' id='Phone_Number_"+no+"' value='"+Phone+"'/>"; | ||
| role.innerHTML="<input type='text' id='Role_"+no+"' value='"+Role+"'/>"; | ||
| address.innerHTML="<input type='text' id='Address_"+no+"' value='"+Address+"'/>"; | ||
| date.innerHTML="<input type='datetime' id='Date_"+no+"' value='"+Date+"'/>"; | ||
| } | ||
| delete(r:number):void{ | ||
| let par=r-1 | ||
| deleteUser(r-1).then(usersArray => {`deleted,${usersArray}`}) | ||
| .catch(()=> {alert("Unexpected delete Error Occured !")}) ; | ||
| CreateTableFromJSON() | ||
| //ListS.splice(r-1,1); | ||
| } | ||
| } | ||
|
|
||
|
|
This file contains hidden or 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,12 @@ | ||
| { | ||
| "name": "front", | ||
| "version": "1.0.0", | ||
| "description": "", | ||
| "main": "server-api/exp22.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC" | ||
| } |
This file contains hidden or 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,46 @@ | ||
| [{ | ||
| "ID":"1", | ||
| "First__Name": "Akanksha", | ||
| "Middle__Name": "", | ||
| "Last__Name": "Singh", | ||
| "Email": "singh@gmail.com", | ||
| "Phone_Number": "9987654321", | ||
| "Role": 1, | ||
| "Address": "Bhopal", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "2", | ||
| "First__Name": "Jai", | ||
| "Middle__Name": "Narayan", | ||
| "Last__Name": "Singh", | ||
| "Email": "jns@gmail.com", | ||
| "Phone_Number": "9087654321", | ||
| "Role": 0, | ||
| "Address": "Pune", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "3", | ||
| "First__Name": "Shurabhi", | ||
| "Middle__Name": "Singh", | ||
| "Last__Name": "Mittal", | ||
| "Email": "ssm@gmail.com", | ||
| "Phone_Number": "8907654321", | ||
| "Role": 0, | ||
| "Address": "Mohali", | ||
| "DateTime":"2020-2-3" | ||
| }, | ||
| { | ||
| "ID": "4", | ||
| "First__Name": "Chavi", | ||
| "Middle__Name": "", | ||
| "Last__Name": "Sonali", | ||
| "Email": "ssp@gmail.com", | ||
| "Phone_Number": "8901234567", | ||
| "Role": 1, | ||
| "Address": "Mumbai", | ||
| "DateTime":"2020-2-3" | ||
| } | ||
|
|
||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comments as in template 7 and please use es6 features, issues with readability and code redundancy