Skip to content

Commit

Permalink
Edited all relations on deletes
Browse files Browse the repository at this point in the history
- Functions project is removed
  • Loading branch information
BenjaVR committed Feb 5, 2019
1 parent a7d8fee commit 8e59ec5
Show file tree
Hide file tree
Showing 82 changed files with 183 additions and 1,171 deletions.
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,26 @@ node_modules/
.env

# IDE
.idea
.idea

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 0 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
{
"type": "npm",
"script": "start",
"path": "web/",
"problemMatcher": [
"$tsc-watch"
],
"isBackground": true,
"group": "build"
},
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
Expand Down
10 changes: 2 additions & 8 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"%RESOURCE_DIR%\" run lint",
"npm --prefix \"%RESOURCE_DIR%\" run build"
]
},
"hosting": {
"public": "web/build",
"public": "./build",
"ignore": [
"firebase.json",
"**/.*",
Expand All @@ -23,4 +17,4 @@
}
]
}
}
}
2 changes: 0 additions & 2 deletions functions/.gitignore

This file was deleted.

24 changes: 0 additions & 24 deletions functions/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions functions/server/ModelMapper.ts

This file was deleted.

60 changes: 0 additions & 60 deletions functions/server/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions functions/shared/contract/IDepartment.ts

This file was deleted.

5 changes: 0 additions & 5 deletions functions/shared/contract/IEducation.ts

This file was deleted.

7 changes: 0 additions & 7 deletions functions/shared/contract/IFirebaseTable.ts

This file was deleted.

10 changes: 0 additions & 10 deletions functions/shared/contract/IInternship.ts

This file was deleted.

5 changes: 0 additions & 5 deletions functions/shared/contract/ISchool.ts

This file was deleted.

10 changes: 0 additions & 10 deletions functions/shared/contract/IStudent.ts

This file was deleted.

18 changes: 0 additions & 18 deletions functions/tsconfig.json

This file was deleted.

3 changes: 0 additions & 3 deletions functions/tslint.json

This file was deleted.

64 changes: 43 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
{
"name": "studentplanner",
"private": true,
"name": "studentplanner-web",
"version": "1.0.0",
"private": true,
"dependencies": {
"@types/react-color": "^2.14.0",
"antd": "3.12.1",
"classnames": "2.2.6",
"core-js": "2.6.1",
"firebase": "5.7.1",
"jest": "23.6.0",
"moment": "2.23.0",
"react": "16.7.0",
"react-color": "2.17.0",
"react-dom": "16.7.0",
"react-helmet": "5.2.0",
"react-router": "4.3.1",
"react-router-dom": "4.3.1",
"whatwg-fetch": "3.0.0"
},
"scripts": {
"build-web": "npm --prefix web run start",
"build-functions": "npm --prefix functions run build:watch",
"build": "npm-run-all --continue-on-error --parallel build-functions build-web",
"lint-web": "npm --prefix web run lint",
"lint-functions": "npm --prefix functions run lint",
"lint": "npm-run-all --continue-on-error --parallel lint-functions lint-web",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"lint": "tslint --project tsconfig.json",
"deploy": "firebase deploy"
},
"repository": "git+https://github.com/BenjaVR/StudentPlanner.git",
"author": "Benjamin Van Renterghem",
"license": "ISC",
"bugs": {
"url": "https://github.com/BenjaVR/StudentPlanner/issues"
},
"homepage": "https://github.com/BenjaVR/StudentPlanner#readme",
"browserslist": [
">0.2%",
"not dead",
"not ie < 11",
"not op_mini all"
],
"devDependencies": {
"npm-run-all": "4.1.5"
},
"workspaces": [
"web",
"functions"
]
"@types/classnames": "2.2.7",
"@types/jest": "23.3.10",
"@types/node": "10.12.18",
"@types/react": "16.7.18",
"@types/react-dom": "16.0.11",
"@types/react-helmet": "5.0.7",
"@types/react-router": "4.4.3",
"@types/react-router-dom": "4.3.1",
"node-sass": "4.11.0",
"react-scripts": "2.1.1",
"tslint": "5.12.0",
"tslint-react": "3.6.0",
"typescript": "3.2.2",
"typescript-plugin-css-modules": "1.0.5"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions web/src/models/Internship.ts → src/models/Internship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Internship extends ModelBase<IInternship> {
public endDate: moment.Moment,
public hours: number,
public studentId: string,
public departmentId: string,
public departmentId: string | undefined,
) {
super();
}
Expand All @@ -21,7 +21,7 @@ export class Internship extends ModelBase<IInternship> {
moment.utc(entity.endDate.toDate()),
entity.hours || 0,
entity.studentId!,
entity.departmentId!,
entity.departmentId,
);
internship.fillBaseFields(entity);
return internship;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Department } from "../../models/Department";
import { Education } from "../../models/Education";
import { FirebaseModelMapper } from "../FirebaseModelMapper";
import { FirestoreRefs } from "../FirestoreRefs";
import { InternshipsRepository } from "./InternshipsRepository";

export class DepartmentsRepository {

Expand Down Expand Up @@ -55,6 +56,13 @@ export class DepartmentsRepository {
}
await FirestoreRefs.getDepartmentDocRef(department.id)
.delete();

// Delete relations with internships
const internships = await InternshipsRepository.getInternshipsForDepartment(department);
internships.forEach(async (internship) => {
internship.departmentId = undefined;
InternshipsRepository.updateInternship(internship, true);
});
}

public static async deleteEducationRelations(education: Education): Promise<void> {
Expand Down
Loading

1 comment on commit 8e59ec5

@BenjaVR
Copy link
Owner

@BenjaVR BenjaVR commented on 8e59ec5 Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#48

Please sign in to comment.