Compare commits
46 Commits
feat/rando
...
master
Author | SHA1 | Date | |
---|---|---|---|
6de23161e9 | |||
5ccd28f815 | |||
4f0cf7906d | |||
90e4c77da8 | |||
9b3aff4dd0 | |||
11de1c5dfe | |||
8f2baabaf2 | |||
e558ca4b61 | |||
de1cb296d3 | |||
b68a8480bd | |||
2e1903429b | |||
d612e74e13 | |||
520e986a55 | |||
0ef4eeb0ac | |||
6d8d7a7c0a | |||
2779667ce8 | |||
bc8410c89d | |||
39a4c07a87 | |||
b9471fe26d | |||
1ed5e53e73 | |||
e0359d579d | |||
ca2d1aede4 | |||
4623127862 | |||
9939f36900 | |||
6d1103a6b9 | |||
2176fbe661 | |||
3a64467661 | |||
78707bf3c5 | |||
74e3957274 | |||
df11ff9005 | |||
42e3cb01f4 | |||
05fde36f41 | |||
37d9d68c82 | |||
3c446802be | |||
4fa04557fb | |||
78a1a53e3b | |||
33149c255b | |||
3b60331091 | |||
80dda549bf | |||
2da7349578 | |||
3d5fa43135 | |||
515f236632 | |||
976498dc50 | |||
df1834d325 | |||
6e7bdb72af | |||
614054acba |
@ -1,9 +1,4 @@
|
||||
BUILD_PATH=$1
|
||||
|
||||
cd $BUILD_PATH/src || exit 1
|
||||
|
||||
docker build -f ./InternshipSystem.Api/Dockerfile -t internship.api .
|
||||
|
||||
cd $BUILD_PATH/.docker || exit 1
|
||||
|
||||
docker-compose up -d --build --force-recreate
|
867
PostmanTestRequest/StudentOperations.postman_collection.json
Normal file
867
PostmanTestRequest/StudentOperations.postman_collection.json
Normal file
@ -0,0 +1,867 @@
|
||||
{
|
||||
"info": {
|
||||
"_postman_id": "f0858747-6271-4176-9193-ed1f9be0d7d3",
|
||||
"name": "StudentOperations",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
},
|
||||
"item": [
|
||||
{
|
||||
"name": "loginDev",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/dev/login",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"dev",
|
||||
"login"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetInternshipManagementList",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjEwMjY2MzcxLCJleHAiOjE2MTAzNTI3NzEsImlhdCI6MTYxMDI2NjM3MX0.PDrMjCHJlpN2FApL6rC-UAoH1ZWAnUImwWfTDhvB5wI",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/internship?OrderByField=InternshipState&SortOrder=Asc",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"internship"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "OrderByField",
|
||||
"value": "InternshipState"
|
||||
},
|
||||
{
|
||||
"key": "SortOrder",
|
||||
"value": "Asc"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetInternshipManagement",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjEwMjY2MzcxLCJleHAiOjE2MTAzNTI3NzEsImlhdCI6MTYxMDI2NjM3MX0.PDrMjCHJlpN2FApL6rC-UAoH1ZWAnUImwWfTDhvB5wI",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/internship/1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"internship",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetInternshipManagementAccept",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjEwMjY2MzcxLCJleHAiOjE2MTAzNTI3NzEsImlhdCI6MTYxMDI2NjM3MX0.PDrMjCHJlpN2FApL6rC-UAoH1ZWAnUImwWfTDhvB5wI",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "\"\""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/internship/accept/1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"internship",
|
||||
"accept",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetInternshipManagementReject",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjEwMjY2MzcxLCJleHAiOjE2MTAzNTI3NzEsImlhdCI6MTYxMDI2NjM3MX0.PDrMjCHJlpN2FApL6rC-UAoH1ZWAnUImwWfTDhvB5wI",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "\"Co żeś odrąbał andzeju\""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/internship/reject/1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"internship",
|
||||
"reject",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "loginEdition",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTUyLCJleHAiOjE2MDEyODM5NTEsImlhdCI6MTYwMTE5NzU1Mn0.0wcNQSXV55MFvEnRLC09nGwCqI7M2kuWdwe0EOV_C6Y",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "\"138da8a3-855c-4b17-9bd2-5f357679efa9\""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/access/loginEdition",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"access",
|
||||
"loginEdition"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "currentInternship",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/internshipRegistration",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"internshipRegistration"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetCourseList",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/course",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"course"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetCourse",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/course/1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"course",
|
||||
"1"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "CreateCourse",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n \"id\": null,\r\n \"name\": \"testowy\",\r\n \"nameEng\": \"test\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/course",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"course"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "UpdateCourse",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n \"id\": 3,\r\n \"name\": \"testowyUp\",\r\n \"nameEng\": \"testUp\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/course",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"course"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "DeleteCourse",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "DELETE",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/course/3",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"course",
|
||||
"3"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetEditionManagementListByCourse",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/editions?course=1",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"editions"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "course",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetEditionManagementList",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/editions",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"editions"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetEditionManagement",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA0ODI3ODgzLCJleHAiOjE2MDQ5MTQyODMsImlhdCI6MTYwNDgyNzg4M30.a3mMm3Zk3xpfsmIwlqtpjgWgTNEXv8O4hH_V_L9UFZo",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/editions/138da8a3-855c-4b17-9bd2-5f357679efa9",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"editions",
|
||||
"138da8a3-855c-4b17-9bd2-5f357679efa9"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "CreateEdition",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n \"editionStart\": \"2020-11-15T11:02:04.002Z\",\r\n \"editionFinish\": \"2020-11-25T11:02:04.002Z\",\r\n \"reportingStart\": \"2020-11-20T11:02:04.002Z\",\r\n \"course\": {\r\n \"id\": 1,\r\n \"name\": \"Informatyka\",\r\n \"nameEng\": \"Informatics\"\r\n },\r\n \"availableSubjectsIds\": [2],\r\n \"availableInternshipTypesIds\": [8]\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/edition",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"edition"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "UpdateEdition",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA2NTk2MzI5LCJleHAiOjE2MDY2ODI3MjksImlhdCI6MTYwNjU5NjMyOX0.O-dLJNI3-tNj96xOpz8LE7zrysmJkN069A3Zku2A7S0",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n \"id\": \"138da8a3-855c-4b17-9bd2-5f357679efa9\",\r\n \"editionStart\": \"2020-11-15T11:02:04.002Z\",\r\n \"editionFinish\": \"2020-11-20T11:02:04.002Z\",\r\n \"reportingStart\": \"2020-11-17T11:02:04.002Z\",\r\n \"course\": {\r\n \"id\": 2,\r\n \"name\": \"Inżynieria Biomedyczna\",\r\n \"nameEng\": \"Biomedical Engineering\"\r\n },\r\n \"availableSubjectsIds\": [3],\r\n \"availableInternshipTypesIds\": [3]\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/editions",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"editions"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "DeleteEditionManagement",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjA0ODI3ODgzLCJleHAiOjE2MDQ5MTQyODMsImlhdCI6MTYwNDgyNzg4M30.a3mMm3Zk3xpfsmIwlqtpjgWgTNEXv8O4hH_V_L9UFZo",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "DELETE",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/management/editions/be1a4439-0360-477c-85c5-e28bc8542883",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"management",
|
||||
"editions",
|
||||
"be1a4439-0360-477c-85c5-e28bc8542883"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "updateRegistration",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n \"company\": {\r\n \"id\": 1,\r\n \"nip\": null,\r\n \"name\": null\r\n },\r\n \"branchOffice\": {\r\n \"id\": 1,\r\n \"street\": null,\r\n \"building\": null,\r\n \"city\": null,\r\n \"postalCode\": null,\r\n \"country\": null\r\n },\r\n \"start\": \"2020-07-27T09:43:49.094Z\",\r\n \"end\": \"2020-09-27T09:43:49.094Z\",\r\n \"type\": {\r\n \"id\": 2,\r\n \"type\": null,\r\n \"description\": null,\r\n \"descriptionEng\": null\r\n }\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/internshipRegistration",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"internshipRegistration"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetRegisteredEditions",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/editions",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"editions"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GetEditionsConfiguration",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"type": "text",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"type": "text",
|
||||
"value": "application/json"
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/editions/138da8a3-855c-4b17-9bd2-5f357679efa9",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"editions",
|
||||
"138da8a3-855c-4b17-9bd2-5f357679efa9"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "RegisterForEdition",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImZpcnN0bmFtZSIsImZhbWlseV9uYW1lIjoibGFzdG5hbWUiLCJQZXJzb25OdW1iZXIiOiIxIiwibmJmIjoxNjAxMTk3NTYzLCJleHAiOjE2MDEyODM5NjMsImlhdCI6MTYwMTE5NzU2MywiRWRpdGlvbiI6IjEzOGRhOGEzLTg1NWMtNGIxNy05YmQyLTVmMzU3Njc5ZWZhOSJ9.l7QK1eUIJexnDaFKZ9yx3NWxmB2KrvPpjLUuuP1EJyE",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "\"138da8a3-855c-4b17-9bd2-5f357679efa9\""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8080/register",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8080",
|
||||
"path": [
|
||||
"register"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
}
|
49
README.MD
Normal file
49
README.MD
Normal file
@ -0,0 +1,49 @@
|
||||
# Uruchomienie
|
||||
|
||||
Aby uruchomić środowisko deweloperskie wystarczy
|
||||
|
||||
```bash
|
||||
docker build -f ./InternshipSystem.Api/Dockerfile -t internship.api .
|
||||
docker-compose -f ./.docker/docker-compose.yaml --build --volumes
|
||||
```
|
||||
|
||||
# Opis struktury
|
||||
|
||||
Opis struktury projektu
|
||||
|
||||
## src/
|
||||
|
||||
zawiera kod podzielony na 3 projekty
|
||||
|
||||
- Api - Definicja interfejsu wystawianego dla częsci frontendowej
|
||||
- Core - Logika biznesowa aplikacji, definicja domeny.
|
||||
- Repository - Definicja repozytorium EFCore
|
||||
|
||||
## test/
|
||||
|
||||
Zawiera testy jednostkowe projektu. Przy pisaniu wykorzystano Machine-Specification
|
||||
|
||||
## .build/
|
||||
|
||||
Folder zawierający pliki definiujące CI/CD projektu
|
||||
|
||||
## .docker/
|
||||
|
||||
Folder zawiera pliki docker-compose przeznaczone do uruchamiania środowiska deweloperskiego, stanowiące również dokumentacje zmiennych środowiskowych konfigurujących projekt
|
||||
|
||||
```yaml
|
||||
CONNECTIONSTRINGS__INTERNSHIPDATABASE: "Host=db.postgres;Port=5432;Database=postgres;Username=postgres;Password=password"
|
||||
ASPNETCORE_ENVIRONMENT: Development
|
||||
ASPNETCORE_URLS: http://+:80
|
||||
SECURITYOPTIONS__SECRET: secret
|
||||
SECURITYOPTIONS__EXPIRATION: 1440 # 24h in minutes
|
||||
SECURITYOPTIONS__BASEURL: https://logowanie.pg.edu.pl
|
||||
SECURITYOPTIONS__TOKENPATH: /oauth2.0/accessToken
|
||||
SECURITYOPTIONS__PROFILEPATH: /oauth2.0/profile
|
||||
SECURITYOPTIONS__CLIENTID: PraktykiClientId
|
||||
SECURITYOPTIONS__REDIRECTURL: https://system-praktyk.net/user/login/check/pg
|
||||
```
|
||||
|
||||
## props/
|
||||
|
||||
Folder ze współdzieloną konfiguracją dla grup projektów, np. wersji bibliotek używanych przy pisaniu testów.
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "3.1.301"
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using AutoMapper;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Result;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
|
||||
@ -18,12 +19,27 @@ namespace InternshipSystem.Api
|
||||
.ForMember(
|
||||
result => result.Status,
|
||||
opt => opt.MapFrom(edition => edition.IsOpen ? "Open" : "Archival"));
|
||||
|
||||
CreateMap<Edition, EditionManagementResult>();
|
||||
|
||||
CreateMap<Edition, EditionDetailsResult>();
|
||||
|
||||
CreateMap<Edition, EditionConfigurationResult>();
|
||||
|
||||
CreateMap<InternshipSubject, InternshipSubject>();
|
||||
|
||||
CreateMap<EditionSubject, InternshipSubject>().IncludeMembers(es => es.Subject);
|
||||
CreateMap<EditionSubject, InternshipSubject>()
|
||||
.IncludeMembers(es => es.Subject);
|
||||
|
||||
CreateMap<EditionInternshipType, InternshipType>()
|
||||
.IncludeMembers(eit => eit.InternshipType);
|
||||
|
||||
CreateMap<ReportFieldEdition, ReportField>()
|
||||
.IncludeMembers(e => e.Field);
|
||||
|
||||
CreateMap<ReportField, ReportField>();
|
||||
|
||||
CreateMap<InternshipType, InternshipType>();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Queries.SearchQuery;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@ -35,9 +36,11 @@ namespace InternshipSystem.Api.Controllers
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IReadOnlyCollection<Company>>> SearchByNameAsync([FromQuery] CompanySearchQuery searchQuery, CancellationToken cancellationToken) =>
|
||||
[Authorize]
|
||||
public async Task<ActionResult<IReadOnlyCollection<Company>>> SearchByNameAsync([FromQuery] CompanySearchQuery searchQuery, [FromServices] User user, CancellationToken cancellationToken) =>
|
||||
await Context.Companies
|
||||
.Where(c => c.Name.ToLower().Contains(searchQuery.Name.ToLower()))
|
||||
.Where(c => c.Provider == 0 || c.Provider == user.PersonNumber)
|
||||
.OrderBy(o => o.Name)
|
||||
.Skip(searchQuery.Page * searchQuery.PerPage)
|
||||
.Take(searchQuery.PerPage)
|
||||
@ -54,7 +57,8 @@ namespace InternshipSystem.Api.Controllers
|
||||
[HttpGet("{companyId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<ActionResult<IReadOnlyCollection<BranchOffice>>> SearchBranchesByAddress([FromQuery] BranchOfficeSearchQuery searchQuery, long companyId, CancellationToken token)
|
||||
[Authorize]
|
||||
public async Task<ActionResult<IReadOnlyCollection<BranchOffice>>> SearchBranchesByAddress([FromQuery] BranchOfficeSearchQuery searchQuery, long companyId, [FromServices] User user, CancellationToken token)
|
||||
{
|
||||
var company = await Context.Companies.Where(c => c.Id == companyId).FirstAsync(token);
|
||||
|
||||
@ -62,6 +66,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
.Collection(c => c.Branches)
|
||||
.Query()
|
||||
.Where(office => office.Address.City.ToLower().Contains(searchQuery.City.ToLower()))
|
||||
.Where(office => office.Provider == 0 || office.Provider == user.PersonNumber)
|
||||
.Skip(searchQuery.Page * searchQuery.PerPage)
|
||||
.Take(searchQuery.PerPage)
|
||||
.ToListAsync(token);
|
||||
|
127
src/InternshipSystem.Api/Controllers/CourseController.cs
Normal file
127
src/InternshipSystem.Api/Controllers/CourseController.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("management/course")]
|
||||
public class CourseController : ControllerBase
|
||||
{
|
||||
private InternshipDbContext Context { get; }
|
||||
|
||||
public CourseController(InternshipDbContext context)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<IReadOnlyCollection<Course>>> GetCourses(CancellationToken cancellationToken) =>
|
||||
await Context.Courses
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
[HttpGet("{courseId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<Course>> GetCourse(long courseId, CancellationToken cancellationToken)
|
||||
{
|
||||
var course = await Context.Courses
|
||||
.Where(c => c.Id == courseId)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (course == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(course);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> UpsertCourse([FromBody] CourseForm courseForm, CancellationToken cancellationToken)
|
||||
{
|
||||
var validator = new CourseForm.Validator();
|
||||
var validationResult = await validator.ValidateAsync(courseForm, cancellationToken);
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
return BadRequest(validationResult.ToString());
|
||||
}
|
||||
|
||||
if (courseForm.Id.HasValue)
|
||||
{
|
||||
var course = await Context.Courses.FindAsync(courseForm.Id.Value);
|
||||
|
||||
if (course == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
course.UpdateCourse(courseForm.Name, courseForm.NameEng);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newCourse = Course.CreateCourse(courseForm.Name, courseForm.NameEng);
|
||||
|
||||
await Context.Courses.AddAsync(newCourse, cancellationToken);
|
||||
}
|
||||
|
||||
await Context.SaveChangesAsync(cancellationToken);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpDelete("{courseId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status409Conflict)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> DeleteCourse(long courseId, CancellationToken cancellationToken)
|
||||
{
|
||||
var courseToDelete = await Context.Courses
|
||||
.Where(c => c.Id == courseId)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (courseToDelete == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var referencedEditions =
|
||||
await Context.Editions
|
||||
.Include(e => e.Course)
|
||||
.Where(e => e.Course.Id == courseToDelete.Id)
|
||||
.CountAsync(cancellationToken);
|
||||
|
||||
if (referencedEditions > 0)
|
||||
{
|
||||
return Conflict();
|
||||
}
|
||||
|
||||
Context.Courses.Remove(courseToDelete);
|
||||
await Context.SaveChangesAsync(cancellationToken);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
|
||||
[ApiController]
|
||||
[Route("management/document")]
|
||||
public class DocumentManagementController : ControllerBase
|
||||
{
|
||||
private InternshipDbContext Context { get; }
|
||||
|
||||
public DocumentManagementController(InternshipDbContext context)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
|
||||
[HttpDelete("{documentId}/delete")]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> DeleteDocument(long documentId, CancellationToken ct)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.Documentation)
|
||||
.FirstOrDefaultAsync(i => i.Documentation.Any(d => d.Id.Equals(documentId)), ct);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
internship.RemoveDocument(documentId);
|
||||
|
||||
await Context.SaveChangesAsync(ct);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPut("{documentId}/accept")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> AcceptDocument(long documentId, [FromBody] string comment, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.Documentation)
|
||||
.FirstOrDefaultAsync(i => i.Documentation.Any(d => d.Id.Equals(documentId)), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var document = internship.Documentation
|
||||
.FirstOrDefault(d => d.Id.Equals(documentId));
|
||||
|
||||
if (document == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
document.State = DocumentState.Accepted;
|
||||
document.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
|
||||
|
||||
await Context.SaveChangesAsync(token);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPut("{documentId}/reject")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> RejectDocument(long documentId, [FromBody] string comment, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.Documentation)
|
||||
.FirstOrDefaultAsync(i => i.Documentation.Any(d => d.Id.Equals(documentId)), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var document = internship.Documentation
|
||||
.FirstOrDefault(d => d.Id.Equals(documentId));
|
||||
|
||||
if (document == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
document.State = DocumentState.Rejected;
|
||||
document.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
|
||||
|
||||
await Context.SaveChangesAsync(token);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using System.Threading;
|
||||
@ -6,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Api.Service;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@ -47,7 +49,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var validator = new DocumentPublishRequest.Validator();
|
||||
var result = await validator.ValidateAsync(documentRequest, cancellationToken);
|
||||
var result = await validator.ValidateAsync(documentRequest, cancellationToken);
|
||||
|
||||
if (!result.IsValid)
|
||||
{
|
||||
@ -60,11 +62,20 @@ namespace InternshipSystem.Api.Controllers
|
||||
await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Documentation)
|
||||
.FirstAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
internship.AddNewDocument(documentRequest.Description, documentRequest.Type);
|
||||
try
|
||||
{
|
||||
internship.AddNewDocument(documentRequest.Description, documentRequest.Type);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
return Ok(internship.Documentation.First(d => d.Type == documentRequest.Type));
|
||||
}
|
||||
|
||||
[HttpPut("{documentId}/scan")]
|
||||
@ -85,17 +96,32 @@ namespace InternshipSystem.Api.Controllers
|
||||
await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Documentation)
|
||||
.Include(i => i.Documentation)
|
||||
.FirstAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
internship.UpdateDocumentScan(documentId, memoryStream.ToArray());
|
||||
var document = await _context.Entry(internship)
|
||||
.Collection(i => i.Documentation)
|
||||
.Query()
|
||||
.Include(d => d.Scan)
|
||||
.FirstAsync(d => d.Id == documentId, cancellationToken);
|
||||
|
||||
document.Scan ??= new DocumentScan();
|
||||
|
||||
document.Scan.Size = memoryStream.Length;
|
||||
document.Scan.Filename = documentScan.FileName;
|
||||
document.Scan.Mime = _fileValidator.GetFileMime(memoryStream.ToArray());
|
||||
document.Scan.File = memoryStream.ToArray();
|
||||
|
||||
document.State = DocumentState.Submitted;
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("{documentId}/scan")]
|
||||
[HttpGet("{documentId}/scan/download")]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult> GetDocumentScan(long documentId, [FromServices] User user, CancellationToken cancellationToken)
|
||||
public async Task<ActionResult> GetDocumentScan(long documentId, [FromQuery] string disposition, [FromServices] User user, CancellationToken cancellationToken)
|
||||
{
|
||||
var edition = await _context.Editions.FirstAsync(e => e.Id == user.EditionId, cancellationToken);
|
||||
|
||||
@ -103,13 +129,53 @@ namespace InternshipSystem.Api.Controllers
|
||||
await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Documentation)
|
||||
.FirstAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
var document = internship.Documentation.First(d => d.Id == documentId);
|
||||
var stream = new MemoryStream(document.Scan);
|
||||
var document =
|
||||
await _context.Entry(internship)
|
||||
.Collection(i => i.Documentation)
|
||||
.Query()
|
||||
.Include(d => d.Scan)
|
||||
.FirstOrDefaultAsync(d => d.Id == documentId, cancellationToken);
|
||||
|
||||
var stream = new MemoryStream(document.Scan.File);
|
||||
|
||||
Response.Headers.Add("Content-Disposition", new ContentDisposition
|
||||
{
|
||||
Inline = disposition == "inline",
|
||||
FileName = document.Scan.Filename,
|
||||
Size = document.Scan.Size
|
||||
}.ToString());
|
||||
|
||||
return File(stream, "application/pdf");
|
||||
return File(stream, document.Scan.Mime);
|
||||
}
|
||||
|
||||
[HttpGet("{documentId}/scan")]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult> GetDocumentScanData(long documentId, [FromServices] User user, CancellationToken cancellationToken)
|
||||
{
|
||||
var edition = await _context.Editions.FirstAsync(e => e.Id == user.EditionId, cancellationToken);
|
||||
|
||||
var internship =
|
||||
await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.FirstAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
var scan =
|
||||
await _context.Entry(internship)
|
||||
.Collection(i => i.Documentation)
|
||||
.Query()
|
||||
.Include(d => d.Scan)
|
||||
.Select(s => new {s.Id, s.Scan.Filename, s.Scan.Mime, s.Scan.Size})
|
||||
.FirstOrDefaultAsync(d => d.Id == documentId, cancellationToken);
|
||||
|
||||
if (scan == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(scan);
|
||||
}
|
||||
}
|
||||
}
|
@ -72,7 +72,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
var edition =
|
||||
await Context.Editions
|
||||
.Where(e => e.Id == id)
|
||||
.ProjectTo<EditionResult?>(Mapper.ConfigurationProvider)
|
||||
.ProjectTo<EditionResult>(Mapper.ConfigurationProvider)
|
||||
.FirstOrDefaultAsync(token);
|
||||
|
||||
if (edition == null)
|
||||
@ -99,6 +99,8 @@ namespace InternshipSystem.Api.Controllers
|
||||
var edition =
|
||||
await Context.Editions
|
||||
.Include(e => e.AvailableSubjects)
|
||||
.Include(e => e.ReportSchema)
|
||||
.ThenInclude(e => e.Field)
|
||||
.Include(e => e.Course)
|
||||
.Where(e => e.Id == user.EditionId)
|
||||
.ProjectTo<EditionConfigurationResult>(Mapper.ConfigurationProvider)
|
||||
|
@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using InternshipSystem.Api.Queries;
|
||||
using InternshipSystem.Api.Queries.SearchQuery;
|
||||
using InternshipSystem.Api.Result;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("management/editions")]
|
||||
public class EditionManagementController : ControllerBase
|
||||
{
|
||||
private InternshipDbContext Context { get; }
|
||||
private IMapper Mapper { get; }
|
||||
|
||||
public EditionManagementController(IMapper mapper, InternshipDbContext context)
|
||||
{
|
||||
Context = context;
|
||||
Mapper = mapper;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<IReadOnlyCollection<EditionManagementResult>>> GetEditions([FromQuery] EditionSearchQuery searchQuery, CancellationToken token) =>
|
||||
await Context.Editions
|
||||
.Include(e => e.Course)
|
||||
.Where(p => !searchQuery.Course.HasValue || p.Course.Id == searchQuery.Course)
|
||||
.ProjectTo<EditionManagementResult>(Mapper.ConfigurationProvider)
|
||||
.Skip(searchQuery.Page * searchQuery.PerPage)
|
||||
.Take(searchQuery.PerPage)
|
||||
.ToListAsync(token);
|
||||
|
||||
|
||||
|
||||
[HttpGet("{editionId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<EditionDetailsResult>> GetFullEdition(Guid editionId, CancellationToken token)
|
||||
{
|
||||
var edition = await Context.Editions
|
||||
.Include(e => e.Course)
|
||||
.Include(e => e.AvailableSubjects)
|
||||
.ThenInclude(s => s.Subject)
|
||||
.Include(e => e.AvailableInternshipTypes)
|
||||
.ThenInclude(i => i.InternshipType)
|
||||
.Include(e => e.ReportSchema)
|
||||
.ThenInclude(er => er.Field)
|
||||
.Where(e => e.Id == editionId)
|
||||
.ProjectTo<EditionDetailsResult>(Mapper.ConfigurationProvider)
|
||||
.FirstOrDefaultAsync(token);
|
||||
|
||||
if (edition == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(edition);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> UpsertEdition(EditionForm editionForm, CancellationToken token)
|
||||
{
|
||||
var validator = new EditionForm.Validator();
|
||||
var validationResult = await validator.ValidateAsync(editionForm, token);
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
return BadRequest(validationResult.ToString());
|
||||
}
|
||||
|
||||
if (editionForm.Id.HasValue)
|
||||
{
|
||||
var editionToUpdate = await Context.Editions
|
||||
.Include(e => e.AvailableSubjects)
|
||||
.Include(e => e.AvailableInternshipTypes)
|
||||
.Include(e => e.ReportSchema)
|
||||
.FirstOrDefaultAsync(e => e.Id == editionForm.Id.Value, token);
|
||||
|
||||
if (editionToUpdate == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
editionToUpdate.UpdateEdition(editionForm.EditionStart, editionForm.EditionFinish, editionForm.ReportingStart,
|
||||
editionForm.Course, editionForm.AvailableSubjectsIds, editionForm.AvailableInternshipTypesIds, editionForm.ReportSchema);
|
||||
|
||||
if (!editionToUpdate.IsValidDates)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var newEdition =
|
||||
Edition.CreateEdition(editionForm.EditionStart.Value, editionForm.EditionFinish.Value, editionForm.ReportingStart.Value,
|
||||
editionForm.Course, editionForm.AvailableSubjectsIds, editionForm.AvailableInternshipTypesIds, editionForm.ReportSchema);
|
||||
|
||||
if (!newEdition.IsValidDates)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
await Context.Editions.AddAsync(newEdition, token);
|
||||
}
|
||||
|
||||
await Context.SaveChangesAsync(token);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpDelete("{editionId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(StatusCodes.Status409Conflict)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> DeleteEdition(Guid editionId, CancellationToken token)
|
||||
{
|
||||
var editionToDelete = await Context.Editions
|
||||
.Include(e => e.AvailableSubjects)
|
||||
.Include(e => e.AvailableInternshipTypes)
|
||||
.Include(e => e.ReportSchema)
|
||||
.FirstOrDefaultAsync(e => e.Id.Equals(editionId), token);
|
||||
|
||||
if (editionToDelete == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var referencedInternships =
|
||||
await Context
|
||||
.Entry(editionToDelete)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.CountAsync(token);
|
||||
|
||||
if (referencedInternships > 0)
|
||||
{
|
||||
return Conflict();
|
||||
}
|
||||
|
||||
Context.Editions.Remove(editionToDelete);
|
||||
await Context.SaveChangesAsync(token);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
56
src/InternshipSystem.Api/Controllers/InternshipController.cs
Normal file
56
src/InternshipSystem.Api/Controllers/InternshipController.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("internship")]
|
||||
public class InternshipController : ControllerBase
|
||||
{
|
||||
private readonly InternshipDbContext _context;
|
||||
|
||||
public InternshipController(InternshipDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get internship for current edition
|
||||
/// </summary>
|
||||
/// <response code="200">If current internship returned successfully</response>
|
||||
/// <response code="401">This action is only available for authorized student registered for current edition</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult<Internship>> GetCurrentEditionInternship([FromServices] User user, CancellationToken cancellationToken)
|
||||
{
|
||||
var edition = await _context.Editions
|
||||
.FindAsync(user.EditionId);
|
||||
|
||||
var internship = await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Student)
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.Include(i => i.InternshipRegistration.Company)
|
||||
.Include(i => i.InternshipRegistration.BranchAddress)
|
||||
.Include(i => i.InternshipRegistration.Type)
|
||||
.Include(i => i.InternshipRegistration.Subjects)
|
||||
.ThenInclude(subject => subject.Subject)
|
||||
.Include(i => i.Report)
|
||||
.Include(i => i.Documentation)
|
||||
.SingleAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
return Ok(internship);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Queries.SearchQuery;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("management/internship")]
|
||||
public class InternshipManagementController : ControllerBase
|
||||
{
|
||||
private InternshipDbContext Context { get; }
|
||||
|
||||
public InternshipManagementController(InternshipDbContext context)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<IReadOnlyCollection<Internship>>> GetInternships([FromQuery] InternshipSearchQuery searchQuery, CancellationToken token)
|
||||
{
|
||||
var query =
|
||||
Context.Internships
|
||||
.Include(i => i.Edition)
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.Include(i => i.InternshipRegistration.Type)
|
||||
.Include(i => i.Student)
|
||||
.Include(i => i.Documentation)
|
||||
.Include(i => i.Report)
|
||||
.Where(i => !searchQuery.EditionId.HasValue || i.Edition.Id == searchQuery.EditionId)
|
||||
.Where(i => !searchQuery.InternshipState.HasValue || i.InternshipRegistration.State == searchQuery.InternshipState)
|
||||
.Where(i => !searchQuery.InternshipState.HasValue || i.Report.State == searchQuery.ReportState)
|
||||
.Where(i => !searchQuery.StudentAlbumNumber.HasValue || i.Student.AlbumNumber == searchQuery.StudentAlbumNumber)
|
||||
.Where(i => string.IsNullOrEmpty(searchQuery.StudentFirstName) || i.Student.FirstName.ToLower().Contains(searchQuery.StudentFirstName.ToLower()))
|
||||
.Where(i => string.IsNullOrEmpty(searchQuery.StudentLastName) || i.Student.LastName.ToLower().Contains(searchQuery.StudentLastName.ToLower()))
|
||||
.Where(i => !searchQuery.DocumentWithState.HasValue || i.Documentation.Any(d => d.State == searchQuery.DocumentWithState))
|
||||
.Skip(searchQuery.Page * searchQuery.PerPage)
|
||||
.Take(searchQuery.PerPage);
|
||||
|
||||
if (searchQuery.OrderByField.ToLower().Equals("date"))
|
||||
{
|
||||
query = searchQuery.SortOrder.Equals(SortOrder.Desc) ?
|
||||
query.OrderByDescending(i => i.InternshipRegistration.SubmissionDate) :
|
||||
query.OrderBy(i => i.InternshipRegistration.SubmissionDate);
|
||||
}
|
||||
else if (searchQuery.OrderByField.ToLower().Equals("internshipstate"))
|
||||
{
|
||||
query = searchQuery.SortOrder.Equals(SortOrder.Desc) ?
|
||||
query.OrderByDescending(i => i.InternshipRegistration.State) :
|
||||
query.OrderBy(i => i.InternshipRegistration.State);
|
||||
}
|
||||
|
||||
var result = await query.ToListAsync(token);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet("{internshipId}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult<Internship>> GetInternship(long internshipId, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.Student)
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.Include(i => i.InternshipRegistration.Company)
|
||||
.Include(i => i.InternshipRegistration.BranchAddress)
|
||||
.Include(i => i.InternshipRegistration.Type)
|
||||
.Include(i => i.InternshipRegistration.Subjects)
|
||||
.ThenInclude(subject => subject.Subject)
|
||||
.Include(i => i.InternshipRegistration.Mentor)
|
||||
.Include(i => i.Report)
|
||||
.Include(i => i.Documentation)
|
||||
.Include(i => i.Edition)
|
||||
.Where(i => i.Id.Equals(internshipId))
|
||||
.FirstOrDefaultAsync(token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(internship);
|
||||
}
|
||||
|
||||
[HttpGet("{internshipId}/status")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> GetInternshipStatus(long internshipId, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.Include(i => i.Report)
|
||||
.Include(i => i.Documentation)
|
||||
.FirstOrDefaultAsync(i => i.Id.Equals(internshipId), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return new JsonResult(new { Errors = internship.ValidateStatus() });
|
||||
}
|
||||
|
||||
[HttpPut("{internshipId}/grade")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> GradeInternship(long internshipId, [FromBody] float grade, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.FirstOrDefaultAsync(i => i.Id.Equals(internshipId), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
internship.Grade = grade;
|
||||
await Context.SaveChangesAsync(token);
|
||||
|
||||
return new JsonResult(new { Errors = internship.ValidateStatus() });
|
||||
}
|
||||
|
||||
[HttpPut("{internshipId}/registration/accept")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> AcceptInternshipRegistration(long internshipId, [FromBody] string comment, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.FirstOrDefaultAsync(i => i.Id.Equals(internshipId), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
internship.InternshipRegistration.State = DocumentState.Accepted;
|
||||
internship.InternshipRegistration.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
|
||||
|
||||
await Context.SaveChangesAsync(token);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpPut("{internshipId}/registration/reject")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> RejectInternshipRegistration(long internshipId, [FromBody] string comment, CancellationToken token)
|
||||
{
|
||||
var internship = await Context.Internships
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.FirstOrDefaultAsync(i => i.Id.Equals(internshipId), token);
|
||||
|
||||
if (internship == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
internship.InternshipRegistration.State = DocumentState.Rejected;
|
||||
internship.InternshipRegistration.ChangeStateComment = string.IsNullOrEmpty(comment) ? null : comment;
|
||||
|
||||
await Context.SaveChangesAsync(token);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,13 @@ using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Api.UseCases;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("internshipRegistration")]
|
||||
public class InternshipRegistrationController : ControllerBase
|
||||
{
|
||||
@ -47,7 +47,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
.ThenInclude(t => t.Subject)
|
||||
.FirstAsync(e => e.Id == user.EditionId, cancellationToken);
|
||||
|
||||
var internshipRegistration =
|
||||
var internship =
|
||||
await _context
|
||||
.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
@ -62,57 +62,24 @@ namespace InternshipSystem.Api.Controllers
|
||||
.ThenInclude(c => c.Type)
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.ThenInclude(c => c.Subjects)
|
||||
.Include(i => i.Documentation)
|
||||
.Where(i => i.Student.Id == user.PersonNumber)
|
||||
.Select(i => i.InternshipRegistration)
|
||||
.FirstAsync(cancellationToken);
|
||||
|
||||
|
||||
var useCase = new UpdateInternshipRegistrationUseCase(_context, internshipRegistration, edition, user);
|
||||
|
||||
var useCase = new UpdateInternshipRegistrationUseCase(_context, internship, edition, user);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await useCase.UpdateInternshipRegistration(registrationCommand, cancellationToken);
|
||||
var (status, result) = await useCase.UpdateInternshipRegistration(registrationCommand, cancellationToken);
|
||||
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
|
||||
return Ok(result);
|
||||
return new JsonResult(new {Status = status, Errors = result});
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get internship for current edition
|
||||
/// </summary>
|
||||
/// <response code="200">If current internship returned successfully</response>
|
||||
/// <response code="401">This action is only available for authorized student registered for current edition</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult<Internship>> GetCurrentEditionInternship([FromServices] User user, CancellationToken cancellationToken)
|
||||
{
|
||||
var edition = await _context.Editions
|
||||
.FindAsync(user.EditionId);
|
||||
|
||||
var internship = await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Student)
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.Include(i => i.InternshipRegistration.Company)
|
||||
.Include(i => i.InternshipRegistration.BranchAddress)
|
||||
.Include(i => i.InternshipRegistration.Type)
|
||||
.Include(i => i.Report)
|
||||
.Include(i => i.Approvals)
|
||||
.Include(i => i.Documentation)
|
||||
.SingleAsync(i => i.Student.Id == user.PersonNumber, cancellationToken);
|
||||
|
||||
return Ok(internship);
|
||||
}
|
||||
}
|
||||
}
|
@ -163,7 +163,6 @@ namespace InternshipSystem.Api.Controllers
|
||||
return NotFound($"Internship type with id: {internshipTypeId} does not exist");
|
||||
}
|
||||
|
||||
Context.InternshipTypes.Attach(internshipTypeToDelete);
|
||||
Context.InternshipTypes.Remove(internshipTypeToDelete);
|
||||
await Context.SaveChangesAsync(cancellationToken);
|
||||
return Ok($"Internship type with id: {internshipTypeId} deleted successfully");
|
||||
|
@ -38,6 +38,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
var edition = await _context.Editions
|
||||
.Include(e => e.Internships)
|
||||
.ThenInclude(i => i.Student)
|
||||
.FirstOrDefaultAsync(e => e.Id.Equals(registrationCode), cancellationToken: token);
|
||||
|
||||
if (edition == null)
|
||||
@ -47,8 +48,15 @@ namespace InternshipSystem.Api.Controllers
|
||||
|
||||
var student = await _context.Students.FindAsync(user.PersonNumber);
|
||||
|
||||
edition.RegisterInternship(student);
|
||||
await _context.SaveChangesAsync(token);
|
||||
try
|
||||
{
|
||||
edition.RegisterInternship(student);
|
||||
await _context.SaveChangesAsync(token);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
62
src/InternshipSystem.Api/Controllers/ReportController.cs
Normal file
62
src/InternshipSystem.Api/Controllers/ReportController.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core.ValueObject;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[Route("internship/report")]
|
||||
public class ReportController : ControllerBase
|
||||
{
|
||||
private readonly InternshipDbContext _context;
|
||||
|
||||
public ReportController(InternshipDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult> PostReport([FromBody] JObject reportValue, [FromServices] User user, CancellationToken ct)
|
||||
{
|
||||
var edition = await _context.Editions
|
||||
.FindAsync(user.EditionId);
|
||||
|
||||
var internship = await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Report)
|
||||
.Include(i => i.Documentation)
|
||||
.SingleAsync(i => i.Student.Id == user.PersonNumber, ct);
|
||||
|
||||
internship.Report.UpdateReport(reportValue.ToString(Formatting.None));
|
||||
internship.AddNewDocument("", DocumentType.InternshipEvaluation);
|
||||
|
||||
await _context.SaveChangesAsync(ct);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Authorize(Policy = Policies.RegisteredOnly)]
|
||||
public async Task<ActionResult> GetReport([FromServices] User user, CancellationToken ct)
|
||||
{
|
||||
var edition = await _context.Editions
|
||||
.FindAsync(user.EditionId);
|
||||
|
||||
var internship = await _context.Entry(edition)
|
||||
.Collection(e => e.Internships)
|
||||
.Query()
|
||||
.Include(i => i.Report)
|
||||
.SingleAsync(i => i.Student.Id == user.PersonNumber, ct);
|
||||
|
||||
return Ok(JsonConvert.DeserializeObject(internship.Report.Value));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using InternshipSystem.Api.Queries.SearchQuery;
|
||||
using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
[Route("management/report")]
|
||||
public class ReportFieldsController : ControllerBase
|
||||
{
|
||||
private readonly InternshipDbContext _context;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public ReportFieldsController(InternshipDbContext context, IMapper mapper)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
}
|
||||
|
||||
[HttpGet("fields")]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<IEnumerable<ReportField>> GetFields(FieldSearchQuery searchQuery, CancellationToken ct) =>
|
||||
await _context.ReportFields
|
||||
.Where(c => c.Label.ToLower().Contains(searchQuery.Label.ToLower()))
|
||||
.OrderBy(o => o.Label)
|
||||
.Skip(searchQuery.Page * searchQuery.PerPage)
|
||||
.Take(searchQuery.PerPage)
|
||||
.ToListAsync(ct);
|
||||
|
||||
[HttpPost("fields")]
|
||||
[Authorize(Policy = Policies.IsOverseer)]
|
||||
public async Task<ActionResult> CreateField([FromBody] FieldCreateRequest request, CancellationToken ct)
|
||||
{
|
||||
ReportField field;
|
||||
|
||||
switch (request.FieldType)
|
||||
{
|
||||
case FieldType.LongText:
|
||||
case FieldType.ShortText:
|
||||
field = new ReportField(request.Label, request.LabelEng, request.Description, request.DescriptionEng, request.FieldType);
|
||||
break;
|
||||
case FieldType.Select:
|
||||
case FieldType.Radial:
|
||||
case FieldType.Checkbox:
|
||||
field = new ReportChoiceField(request.Label, request.LabelEng, request.Description, request.DescriptionEng, request.FieldType, request.Choices);
|
||||
break;
|
||||
default:
|
||||
return BadRequest("Unknown field type");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _context.ReportFields.AddAsync(field, ct);
|
||||
await _context.SaveChangesAsync(ct);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest("Failed");
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
public class FieldSearchQuery : SearchQuery
|
||||
{
|
||||
public string Label { get; set; } = "";
|
||||
}
|
||||
|
||||
public class FieldCreateRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string LabelEng { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DescriptionEng { get; set; }
|
||||
public FieldType FieldType { get; set; }
|
||||
public string[] Choices { get; set; }
|
||||
}
|
||||
}
|
@ -121,7 +121,7 @@ namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
AccessName = staticPageForm.AccessName.ToLower().Trim(),
|
||||
Title = staticPageForm.Title,
|
||||
TitleEng = staticPageForm.Title,
|
||||
TitleEng = staticPageForm.TitleEng,
|
||||
Content = staticPageForm.Content,
|
||||
ContentEng = staticPageForm.ContentEng,
|
||||
};
|
||||
@ -155,7 +155,6 @@ namespace InternshipSystem.Api.Controllers
|
||||
return NotFound($"Static page with access name: {accessName} does not exist");
|
||||
}
|
||||
|
||||
Context.StaticPages.Attach(pageToDelete);
|
||||
Context.StaticPages.Remove(pageToDelete);
|
||||
await Context.SaveChangesAsync(cancellationToken);
|
||||
return Ok($"Static page with access name: {accessName} deleted successfully");
|
||||
|
37
src/InternshipSystem.Api/Converters/StringArrayConverter.cs
Normal file
37
src/InternshipSystem.Api/Converters/StringArrayConverter.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace InternshipSystem.Api.Converters
|
||||
{
|
||||
public class StringArrayConverter<TItem> : JsonConverter
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var token = JToken.Load(reader);
|
||||
|
||||
if (token.Type == JTokenType.Array)
|
||||
{
|
||||
return token.ToObject<List<TItem>>();
|
||||
}
|
||||
|
||||
return new List<TItem>
|
||||
{
|
||||
token.ToObject<TItem>()
|
||||
};
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(List<TItem>);
|
||||
}
|
||||
|
||||
public override bool CanWrite => false;
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Api.Options;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using JsonConverter = System.Text.Json.Serialization.JsonConverter;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
@ -39,9 +41,9 @@ namespace InternshipSystem.Api.Controllers
|
||||
};
|
||||
|
||||
var response = await _client.SendAsync(request, cancellationToken);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync();
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var value = await JsonSerializer.DeserializeAsync<Dictionary<string, object>>(stream);
|
||||
var value = JsonConvert.DeserializeObject<Dictionary<string, object>>(content);
|
||||
|
||||
return value["access_token"].ToString();
|
||||
}
|
||||
@ -60,15 +62,10 @@ namespace InternshipSystem.Api.Controllers
|
||||
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
|
||||
|
||||
var response = await _client.SendAsync(request, cancellationToken);
|
||||
await using var stream = await response.Content.ReadAsStreamAsync();
|
||||
|
||||
var result = await JsonSerializer.DeserializeAsync<CasUserProfile>(
|
||||
stream,
|
||||
new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var result = JsonConvert.DeserializeObject<CasUserProfile>(content);
|
||||
|
||||
return result.Attributes;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,8 @@
|
||||
<PackageReference Include="Serilog" Version="2.9.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.3.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.6.3" />
|
||||
<PackageReference Include="IdentityServer4" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
23
src/InternshipSystem.Api/Queries/CourseForm.cs
Normal file
23
src/InternshipSystem.Api/Queries/CourseForm.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class CourseForm
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string NameEng { get; set; }
|
||||
|
||||
public class Validator : AbstractValidator<CourseForm>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(c => c.Id).NotNull()
|
||||
.When(c => string.IsNullOrWhiteSpace(c.Name));
|
||||
|
||||
RuleFor(c => c.Name).NotEmpty()
|
||||
.When(c => !c.Id.HasValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,16 +6,11 @@ namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class DocumentPublishRequest
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DocumentType Type { get; set; }
|
||||
|
||||
public class Validator : AbstractValidator<DocumentPublishRequest>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(document => document.Type).NotEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
src/InternshipSystem.Api/Queries/EditionForm.cs
Normal file
40
src/InternshipSystem.Api/Queries/EditionForm.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
|
||||
namespace InternshipSystem.Api.Queries
|
||||
{
|
||||
public class EditionForm
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public DateTime? EditionStart { get; set; }
|
||||
public DateTime? EditionFinish { get; set; }
|
||||
public DateTime? ReportingStart { get; set; }
|
||||
public Course Course { get; set; }
|
||||
public List<long> AvailableSubjectsIds { get; set; } = new List<long>();
|
||||
public List<long> AvailableInternshipTypesIds { get; set; } = new List<long>();
|
||||
public List<long> ReportSchema { get; set; } = new List<long>();
|
||||
|
||||
public class Validator : AbstractValidator<EditionForm>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(e => e.Id).NotNull()
|
||||
.When(e => !e.EditionStart.HasValue || !e.EditionFinish.HasValue
|
||||
|| !e.ReportingStart.HasValue || e.Course == null);
|
||||
|
||||
RuleFor(e => e.EditionStart).NotEmpty()
|
||||
.When(e => !e.Id.HasValue);
|
||||
RuleFor(e => e.EditionFinish).NotEmpty()
|
||||
.When(e => !e.Id.HasValue);
|
||||
RuleFor(e => e.ReportingStart).NotEmpty()
|
||||
.When(e => !e.Id.HasValue);
|
||||
RuleFor(e => e.Course).NotNull()
|
||||
.When(e => !e.Id.HasValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
namespace InternshipSystem.Api.Queries.SearchQuery
|
||||
{
|
||||
public class EditionSearchQuery : SearchQuery
|
||||
{
|
||||
public long? Course { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using InternshipSystem.Core;
|
||||
|
||||
namespace InternshipSystem.Api.Queries.SearchQuery
|
||||
{
|
||||
public class InternshipSearchQuery : SearchQuery
|
||||
{
|
||||
public Guid? EditionId { get; set; } = null;
|
||||
public DocumentState? InternshipState { get; set; } = null;
|
||||
public DocumentState? ReportState { get; set; }
|
||||
public int? StudentAlbumNumber { get; set; } = null;
|
||||
public string StudentFirstName { get; set; } = "";
|
||||
public string StudentLastName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// SortValue: Date, InternshipState
|
||||
/// </summary>
|
||||
public string OrderByField { get; set; } = "";
|
||||
public SortOrder SortOrder { get; set; } = SortOrder.None;
|
||||
|
||||
public DocumentState? DocumentWithState { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace InternshipSystem.Api.Queries.SearchQuery
|
||||
{
|
||||
public enum SortOrder
|
||||
{
|
||||
Asc,
|
||||
Desc,
|
||||
None
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using InternshipSystem.Api.Converters;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace InternshipSystem.Api.Controllers
|
||||
{
|
||||
@ -7,8 +9,12 @@ namespace InternshipSystem.Api.Controllers
|
||||
public string AlbumNumber { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringArrayConverter<string>))]
|
||||
public List<string> Mail { get; set; }
|
||||
public string PersonNumber { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringArrayConverter<string>))]
|
||||
public List<string> Pg_Cui_Portalroles { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
|
||||
@ -9,6 +10,7 @@ namespace InternshipSystem.Api.Result
|
||||
public class EditionConfigurationResult
|
||||
{
|
||||
public List<InternshipSubject> AvailableSubjects { get; set; }
|
||||
public List<ReportField> ReportSchema { get; set; }
|
||||
public Course Course { get; set; }
|
||||
public DateTime EditionStart { get; set; }
|
||||
public DateTime EditionFinish { get; set; }
|
||||
|
20
src/InternshipSystem.Api/Result/EditionDetailsResult.cs
Normal file
20
src/InternshipSystem.Api/Result/EditionDetailsResult.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
|
||||
namespace InternshipSystem.Api.Result
|
||||
{
|
||||
public class EditionDetailsResult
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public DateTime EditionStart { get; set; }
|
||||
public DateTime EditionFinish { get; set; }
|
||||
public DateTime ReportingStart { get; set; }
|
||||
public Course Course { get; set; }
|
||||
public List<InternshipSubject> AvailableSubjects { get; set; }
|
||||
public List<InternshipType> AvailableInternshipTypes { get; set; }
|
||||
public List<ReportField> ReportSchema { get; set; }
|
||||
}
|
||||
}
|
15
src/InternshipSystem.Api/Result/EditionManagementResult.cs
Normal file
15
src/InternshipSystem.Api/Result/EditionManagementResult.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
|
||||
namespace InternshipSystem.Api.Result
|
||||
{
|
||||
public class EditionManagementResult
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public DateTime EditionStart { get; set; }
|
||||
public DateTime EditionFinish { get; set; }
|
||||
public DateTime ReportingStart { get; set; }
|
||||
public Course Course { get; set; }
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace InternshipSystem.Api.Result
|
||||
{
|
||||
public struct EditionResult
|
||||
public class EditionResult
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public DateTime EditionStart { get; set; }
|
||||
|
@ -3,5 +3,6 @@
|
||||
public static class Policies
|
||||
{
|
||||
public const string RegisteredOnly = "RegisteredForEditionOnly";
|
||||
public const string IsOverseer = "IsOverseer";
|
||||
}
|
||||
}
|
@ -5,12 +5,15 @@ namespace InternshipSystem.Api.Service
|
||||
{
|
||||
public class FileValidator
|
||||
{
|
||||
private readonly Dictionary<string, byte[]> validFileTypes;
|
||||
private readonly List<(string Mime, byte[] Signature)> validFileTypes;
|
||||
|
||||
public FileValidator()
|
||||
{
|
||||
validFileTypes = new Dictionary<string, byte[]> {
|
||||
{ "pdf", new byte[] { 0x25, 0x50, 0x44, 0x46 } }
|
||||
validFileTypes = new List<(string, byte[])> {
|
||||
("application/pdf", new byte[] { 0x25, 0x50, 0x44, 0x46 }),
|
||||
("image/jpeg", new byte[] { 0xFF, 0xD8, 0xFF, 0xDB }),
|
||||
("image/jpeg", new byte[] { 0xFF, 0xD8, 0xFF, 0xE0 }),
|
||||
("image/jpeg", new byte[] { 0xFF, 0xD8, 0xFF, 0xE1 })
|
||||
};
|
||||
}
|
||||
|
||||
@ -21,10 +24,14 @@ namespace InternshipSystem.Api.Service
|
||||
|
||||
private bool IsFileValidType(byte[] scan)
|
||||
{
|
||||
var validSignatures = validFileTypes.Values;
|
||||
return GetFileMime(scan) != null;
|
||||
}
|
||||
|
||||
public string GetFileMime(byte[] scan)
|
||||
{
|
||||
var header = scan[..4];
|
||||
|
||||
return validSignatures.Any(sig => header.SequenceEqual(header));
|
||||
return validFileTypes.FirstOrDefault(sig => sig.Signature.SequenceEqual(header)).Mime;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace InternshipSystem.Api
|
||||
{
|
||||
@ -37,6 +38,8 @@ namespace InternshipSystem.Api
|
||||
.AddAuthorization(o =>
|
||||
{
|
||||
o.AddPolicy(Policies.RegisteredOnly, policy => policy.RequireClaim("Edition"));
|
||||
//TODO: change to claim for InternshipRepresentative
|
||||
o.AddPolicy(Policies.IsOverseer, policy => policy.RequireClaim("PersonNumber"));
|
||||
})
|
||||
.AddHttpClient<GutCasClient>();
|
||||
|
||||
@ -56,8 +59,13 @@ namespace InternshipSystem.Api
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
options.IncludeXmlComments(xmlPath);
|
||||
})
|
||||
.AddSwaggerGenNewtonsoftSupport()
|
||||
.AddControllers(o => { o.ModelBinderProviders.Insert(0, new UserBinderProvider()); })
|
||||
.AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
options.SerializerSettings.Converters.Add(new StringEnumConverter());
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
|
@ -9,6 +9,7 @@ using InternshipSystem.Api.Security;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
using InternshipSystem.Core.ValueObject;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@ -17,25 +18,27 @@ namespace InternshipSystem.Api.UseCases
|
||||
public class UpdateInternshipRegistrationUseCase
|
||||
{
|
||||
private readonly InternshipDbContext _dbContext;
|
||||
private readonly Internship _internship;
|
||||
private readonly Edition _edition;
|
||||
private readonly User _user;
|
||||
private readonly InternshipRegistration subjectRegistration;
|
||||
|
||||
public UpdateInternshipRegistrationUseCase(InternshipDbContext dbContext,
|
||||
InternshipRegistration internshipRegistration, Edition edition, User user)
|
||||
Internship internship, Edition edition, User user)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_internship = internship;
|
||||
_edition = edition;
|
||||
_user = user;
|
||||
subjectRegistration = internshipRegistration;
|
||||
_internship = internship;
|
||||
subjectRegistration = internship.InternshipRegistration;
|
||||
}
|
||||
|
||||
public async Task<string> UpdateInternshipRegistration(
|
||||
public async Task<(DocumentState State, IEnumerable<ErrorDescription>)> UpdateInternshipRegistration(
|
||||
UpdateRegistrationForm registrationCommand,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
subjectRegistration.Start = registrationCommand.Start ?? subjectRegistration.Start;
|
||||
subjectRegistration.End = registrationCommand.End ?? subjectRegistration.End;
|
||||
UpdateTimeFrame(registrationCommand);
|
||||
subjectRegistration.DeclaredHours = registrationCommand.Hours ?? subjectRegistration.DeclaredHours;
|
||||
|
||||
if (registrationCommand.Type.HasValue)
|
||||
@ -61,9 +64,43 @@ namespace InternshipSystem.Api.UseCases
|
||||
return subjectRegistration.ValidateStatus(_edition);
|
||||
}
|
||||
|
||||
private void UpdateTimeFrame(UpdateRegistrationForm registrationCommand)
|
||||
{
|
||||
subjectRegistration.Start = registrationCommand.Start ?? subjectRegistration.Start;
|
||||
subjectRegistration.End = registrationCommand.End ?? subjectRegistration.End;
|
||||
|
||||
if (!_edition.IsDateDuringEdition(subjectRegistration.Start, subjectRegistration.End))
|
||||
{
|
||||
_internship.AddNewDocument("", DocumentType.OutsideTermApproval);
|
||||
}
|
||||
else
|
||||
{
|
||||
_internship.RemoveDocument(DocumentType.OutsideTermApproval);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateInternshipType(long typeId)
|
||||
{
|
||||
var editionInternshipType = _edition.AvailableInternshipTypes.FirstOrDefault(i => i.InternshipTypeId == typeId);
|
||||
|
||||
if (editionInternshipType?.InternshipType.RequireDeansApproval == true)
|
||||
{
|
||||
_internship.AddNewDocument("", DocumentType.InternshipTypeApproval);
|
||||
}
|
||||
else
|
||||
{
|
||||
_internship.RemoveDocument(DocumentType.InternshipTypeApproval);
|
||||
}
|
||||
|
||||
if (editionInternshipType?.InternshipType.RequireInsurance == true)
|
||||
{
|
||||
_internship.AddNewDocument("", DocumentType.NnwInsurance);
|
||||
}
|
||||
else
|
||||
{
|
||||
_internship.RemoveDocument(DocumentType.NnwInsurance);
|
||||
}
|
||||
|
||||
subjectRegistration.Type = editionInternshipType?.InternshipType ?? subjectRegistration.Type;
|
||||
}
|
||||
|
||||
@ -144,6 +181,8 @@ namespace InternshipSystem.Api.UseCases
|
||||
|
||||
private void UpdateMentor(UpdateMentor mentorUpdate)
|
||||
{
|
||||
subjectRegistration.Mentor ??= new Mentor();
|
||||
|
||||
subjectRegistration.Mentor.UpdateInformation(mentorUpdate.FirstName, mentorUpdate.LastName, mentorUpdate.Email, mentorUpdate.PhoneNumber);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ namespace InternshipSystem.Core
|
||||
{
|
||||
Nip = nip,
|
||||
Name = name,
|
||||
Provider = provider
|
||||
Provider = provider,
|
||||
Branches = new List<BranchOffice>()
|
||||
};
|
||||
|
||||
public void AddBranchOffice(BranchOffice createBranch)
|
||||
@ -31,8 +32,12 @@ namespace InternshipSystem.Core
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(x => x.Nip).NotNull();
|
||||
RuleFor(x => x.Name).NotNull();
|
||||
RuleFor(x => x.Nip)
|
||||
.NotEmpty()
|
||||
.WithMessage("error.company.nip.empty");
|
||||
RuleFor(x => x.Name)
|
||||
.NotEmpty()
|
||||
.WithMessage("error.company.name.empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,24 @@
|
||||
namespace InternshipSystem.Core
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace InternshipSystem.Core.Entity
|
||||
{
|
||||
public class Course
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string NameEng { get; set; }
|
||||
|
||||
public static Course CreateCourse(string name, string nameEng) =>
|
||||
new Course
|
||||
{
|
||||
Name = name,
|
||||
NameEng = nameEng,
|
||||
};
|
||||
|
||||
public void UpdateCourse(string name, string nameEng)
|
||||
{
|
||||
Name = name;
|
||||
NameEng = nameEng;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,9 +6,19 @@ namespace InternshipSystem.Core
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Description { get; set; }
|
||||
public byte[] Scan { get; set; }
|
||||
public DocumentScan Scan { get; set; }
|
||||
public DocumentType Type { get; set; }
|
||||
public DocumentState State { get; set; }
|
||||
public string RejectionReason { get; set; }
|
||||
public string ChangeStateComment { get; set; }
|
||||
}
|
||||
|
||||
public class DocumentScan
|
||||
{
|
||||
public long DocumentId { get; set; }
|
||||
public Document Document { get; set; }
|
||||
public long Size { get; set; }
|
||||
public string Filename { get; set; }
|
||||
public string Mime { get; set; }
|
||||
public byte[] File { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
|
||||
@ -16,23 +17,110 @@ namespace InternshipSystem.Core
|
||||
public List<Internship> Internships { get; set; }
|
||||
public List<EditionSubject> AvailableSubjects { get; set; }
|
||||
public List<EditionInternshipType> AvailableInternshipTypes { get; set; }
|
||||
public List<ReportFieldEdition> ReportSchema { get; set; }
|
||||
|
||||
public bool IsOpen => EditionFinish < DateTime.Today;
|
||||
|
||||
public Edition CreateEdition(DateTime start, DateTime end, DateTime reportingStart)
|
||||
|
||||
public static Edition CreateEdition(DateTime start, DateTime end, DateTime reportingStart, Course course,
|
||||
IEnumerable<long> subjectsIds, IEnumerable<long> internshipTypesIds, IEnumerable<long> reportFieldIds)
|
||||
{
|
||||
var newEdition = CreateEdition(start, end, reportingStart, course);
|
||||
|
||||
newEdition.AvailableSubjects =
|
||||
subjectsIds
|
||||
.Select(s => new EditionSubject
|
||||
{
|
||||
Edition = newEdition,
|
||||
InternshipSubjectId = s,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
newEdition.AvailableInternshipTypes =
|
||||
internshipTypesIds
|
||||
.Select(i => new EditionInternshipType
|
||||
{
|
||||
Edition = newEdition,
|
||||
InternshipTypeId = i,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
newEdition.ReportSchema =
|
||||
reportFieldIds
|
||||
.Select(i => new ReportFieldEdition
|
||||
{
|
||||
Edition = newEdition,
|
||||
ReportFieldId = i,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return newEdition;
|
||||
}
|
||||
|
||||
public static Edition CreateEdition(DateTime start, DateTime end, DateTime reportingStart, Course course)
|
||||
{
|
||||
return new Edition
|
||||
{
|
||||
EditionStart = start,
|
||||
EditionFinish = end,
|
||||
ReportingStart = reportingStart
|
||||
ReportingStart = reportingStart,
|
||||
Course = course,
|
||||
AvailableSubjects = new List<EditionSubject>(),
|
||||
AvailableInternshipTypes = new List<EditionInternshipType>(),
|
||||
ReportSchema = new List<ReportFieldEdition>()
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdateEdition(DateTime? start, DateTime? end, DateTime? reportingStart, Course course,
|
||||
IEnumerable<long> subjectsIds, IEnumerable<long> internshipTypesIds, IEnumerable<long> reportFieldIds)
|
||||
{
|
||||
EditionStart = start ?? EditionStart;
|
||||
EditionFinish = end ?? EditionFinish;
|
||||
ReportingStart = reportingStart ?? ReportingStart;
|
||||
Course = course;
|
||||
|
||||
if (subjectsIds != null)
|
||||
{
|
||||
AvailableSubjects =
|
||||
subjectsIds
|
||||
.Select(s => new EditionSubject
|
||||
{
|
||||
InternshipSubjectId = s,
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (internshipTypesIds != null)
|
||||
{
|
||||
AvailableInternshipTypes =
|
||||
internshipTypesIds
|
||||
.Select(i => new EditionInternshipType
|
||||
{
|
||||
InternshipTypeId = i,
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (reportFieldIds != null)
|
||||
{
|
||||
ReportSchema =
|
||||
reportFieldIds
|
||||
.Select(i => new ReportFieldEdition
|
||||
{
|
||||
ReportFieldId = i,
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterInternship(Student student)
|
||||
{
|
||||
var internship = Internship.CreateStudentsInternship(student);
|
||||
if (Internships.Any(i => i.Student.Id == student.Id))
|
||||
{
|
||||
throw new ArgumentException("error.registration.already_registered");
|
||||
}
|
||||
|
||||
var internship = Internship.CreateStudentsInternship(student);
|
||||
|
||||
Internships.Add(internship);
|
||||
}
|
||||
|
||||
@ -50,5 +138,7 @@ namespace InternshipSystem.Core
|
||||
{
|
||||
return internshipSubjects.All(s => AvailableSubjects.Any(su => su.InternshipSubjectId == s));
|
||||
}
|
||||
|
||||
public bool IsValidDates => EditionStart <= EditionFinish;
|
||||
}
|
||||
}
|
15
src/InternshipSystem.Core/Entity/Internship/Extensions.cs
Normal file
15
src/InternshipSystem.Core/Entity/Internship/Extensions.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation.Results;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
|
||||
namespace InternshipSystem.Core
|
||||
{
|
||||
static internal class Extensions
|
||||
{
|
||||
public static IEnumerable<ErrorDescription> ToErrorDescription(this ValidationResult result)
|
||||
{
|
||||
return result.Errors.Select(failure => new ErrorDescription { Key = failure.ErrorCode, Parameters = failure.FormattedMessagePlaceholderValues });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using InternshipSystem.Core.ValueObject;
|
||||
|
||||
namespace InternshipSystem.Core.Entity.Internship
|
||||
@ -10,9 +12,7 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
public Student Student { get; set; }
|
||||
public InternshipRegistration InternshipRegistration { get; set; }
|
||||
public Report Report { get; set; }
|
||||
public List<Document> Approvals { get; set; }
|
||||
public List<Document> Documentation { get; set; }
|
||||
|
||||
public Edition Edition { get; set; }
|
||||
|
||||
public float? Grade { get; set; }
|
||||
@ -25,14 +25,23 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
|
||||
internship.InternshipRegistration = InternshipRegistration.Create();
|
||||
internship.Report = Report.Create();
|
||||
internship.Approvals = new List<Document>();
|
||||
internship.Documentation = new List<Document>();
|
||||
|
||||
if (student.Semester != 6)
|
||||
{
|
||||
internship.AddNewDocument("", DocumentType.OutsideSemesterApproval);
|
||||
}
|
||||
|
||||
return internship;
|
||||
}
|
||||
|
||||
public void AddNewDocument(string description, DocumentType type)
|
||||
{
|
||||
if (type != DocumentType.Other && Documentation.Any(d => d.Type == type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var document = new Document
|
||||
{
|
||||
Description = description,
|
||||
@ -43,12 +52,54 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
Documentation.Add(document);
|
||||
}
|
||||
|
||||
public void UpdateDocumentScan(long documentId, byte[] documentScan)
|
||||
public void RemoveDocument(DocumentType documentType)
|
||||
{
|
||||
var document = Documentation.First(d => d.Id == documentId);
|
||||
if (documentType == DocumentType.Other)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var doc = Documentation.FirstOrDefault(d => d.Type == documentType);
|
||||
|
||||
document.Scan = documentScan;
|
||||
document.State = DocumentState.Submitted;
|
||||
if (doc != null)
|
||||
{
|
||||
Documentation.Remove(doc);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveDocument(long id)
|
||||
{
|
||||
var doc = Documentation.FirstOrDefault(d => d.Id == id);
|
||||
|
||||
if (doc != null)
|
||||
{
|
||||
Documentation.Remove(doc);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<ErrorDescription> ValidateStatus()
|
||||
{
|
||||
var validator = new Validator();
|
||||
|
||||
var result = validator.Validate(this);
|
||||
|
||||
return result.ToErrorDescription();
|
||||
}
|
||||
|
||||
private class Validator : AbstractValidator<Internship>
|
||||
{
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(i => i.Report)
|
||||
.Must(r => r.State == DocumentState.Accepted)
|
||||
.WithMessage("error.report.not_accepted");
|
||||
RuleFor(i => i.InternshipRegistration)
|
||||
.Must(r => r.State == DocumentState.Accepted)
|
||||
.WithMessage("error.registration.not_accepted");
|
||||
RuleForEach(i => i.Documentation)
|
||||
.Must(d => d.State == DocumentState.Accepted)
|
||||
.WithMessage("error.documentation.not_accepted");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,14 +11,15 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
public long Id { get; set; }
|
||||
public Company Company { get; set; }
|
||||
public BranchOffice BranchAddress { get; set; }
|
||||
public DateTime SubmissionDate { get; set; }
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public Mentor Mentor { get; set; }
|
||||
public List<ProgramSubject> Subjects { get; set; }
|
||||
public InternshipType Type { get; set; }
|
||||
|
||||
public int DeclaredHours { get; set; }
|
||||
public DocumentState State { get; set; }
|
||||
public string ChangeStateComment { get; set; }
|
||||
|
||||
public static InternshipRegistration Create()
|
||||
{
|
||||
@ -26,7 +27,7 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
}
|
||||
|
||||
|
||||
public string ValidateStatus(Edition edition)
|
||||
public (DocumentState State, IEnumerable<ErrorDescription>) ValidateStatus(Edition edition)
|
||||
{
|
||||
var validator = new Validator(edition);
|
||||
|
||||
@ -34,7 +35,9 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
|
||||
State = result.IsValid ? DocumentState.Submitted : DocumentState.Draft;
|
||||
|
||||
return result.ToString();
|
||||
SubmissionDate = DocumentState.Submitted.Equals(State) ? DateTime.UtcNow.AddHours(1) : SubmissionDate;
|
||||
|
||||
return (State, result.ToErrorDescription());
|
||||
}
|
||||
|
||||
public class Validator : AbstractValidator<InternshipRegistration>
|
||||
@ -52,19 +55,28 @@ namespace InternshipSystem.Core.Entity.Internship
|
||||
.NotNull();
|
||||
RuleFor(x => x.Subjects)
|
||||
.NotEmpty()
|
||||
.Must(s => edition.AreSubjectsAvailable(s.Select(su => su.InternshipSubjectId)));
|
||||
.Must(s => edition.AreSubjectsAvailable(s.Select(su => su.InternshipSubjectId)))
|
||||
.WithMessage("error.subjects.not_available");
|
||||
RuleFor(x => x.Type)
|
||||
.NotNull()
|
||||
.Must(edition.IsTypeAvailable);
|
||||
.Must(edition.IsTypeAvailable)
|
||||
.WithMessage("error.type.not_available");
|
||||
RuleFor(x => x.Start)
|
||||
.GreaterThanOrEqualTo(edition.EditionStart)
|
||||
.LessThan(x => x.End)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.start_date.empty");
|
||||
RuleFor(x => x.End)
|
||||
.LessThanOrEqualTo(edition.EditionFinish)
|
||||
.GreaterThan(x => x.Start)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.end_date.empty");
|
||||
RuleFor(x => x.DeclaredHours)
|
||||
.NotEmpty()
|
||||
.WithMessage("error.declared_hours.empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ErrorDescription
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public Dictionary<string, object> Parameters { get; set; }
|
||||
}
|
||||
}
|
@ -7,5 +7,7 @@
|
||||
public string LabelEng { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DescriptionEng { get; set; }
|
||||
public bool RequireDeansApproval { get; set; }
|
||||
public bool RequireInsurance { get; set; }
|
||||
}
|
||||
}
|
@ -6,12 +6,17 @@ namespace InternshipSystem.Core
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DocumentState State { get; set; }
|
||||
public RangeOfActivity Range { get; set; }
|
||||
public Uri SiteAddress { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public static Report Create()
|
||||
{
|
||||
return new Report();
|
||||
}
|
||||
|
||||
public void UpdateReport(string reportValue)
|
||||
{
|
||||
Value = reportValue;
|
||||
State = DocumentState.Submitted;
|
||||
}
|
||||
}
|
||||
}
|
49
src/InternshipSystem.Core/Entity/ReportField.cs
Normal file
49
src/InternshipSystem.Core/Entity/ReportField.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace InternshipSystem.Core.Entity
|
||||
{
|
||||
public class ReportField
|
||||
{
|
||||
public ReportField()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ReportField(string label, string labelEng, string description, string descriptionEng, FieldType fieldType)
|
||||
{
|
||||
Label = label;
|
||||
LabelEng = labelEng;
|
||||
Description = description;
|
||||
DescriptionEng = descriptionEng;
|
||||
FieldType = fieldType;
|
||||
}
|
||||
|
||||
public long Id { get; set; }
|
||||
public string Label { get; set; }
|
||||
public string LabelEng { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DescriptionEng { get; set; }
|
||||
public FieldType FieldType { get; set; }
|
||||
}
|
||||
|
||||
public enum FieldType
|
||||
{
|
||||
LongText,
|
||||
ShortText,
|
||||
Select,
|
||||
Radial,
|
||||
Checkbox
|
||||
}
|
||||
|
||||
public class ReportChoiceField : ReportField
|
||||
{
|
||||
public ReportChoiceField(string label, string labelEng, string description, string descriptionEng,
|
||||
FieldType fieldType, string[] choices) : base(label, labelEng, description, descriptionEng, fieldType)
|
||||
{
|
||||
Choices = choices;
|
||||
}
|
||||
|
||||
public string[] Choices { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using InternshipSystem.Core.Entity;
|
||||
|
||||
namespace InternshipSystem.Core.UglyOrmArtifacts
|
||||
{
|
||||
public class ReportFieldEdition
|
||||
{
|
||||
public Guid EditionId { get; set; }
|
||||
public Edition Edition { get; set; }
|
||||
public long ReportFieldId { get; set; }
|
||||
public ReportField Field { get; set; }
|
||||
}
|
||||
}
|
@ -16,15 +16,20 @@ namespace InternshipSystem.Core
|
||||
public Validator()
|
||||
{
|
||||
RuleFor(x => x.Country)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.branch.country.empty");
|
||||
RuleFor(x => x.City)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.branch.city.empty");
|
||||
RuleFor(x => x.PostalCode)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.branch.postal_code.empty");
|
||||
RuleFor(x => x.Street)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.branch.street.empty");
|
||||
RuleFor(x => x.Building)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.branch.building.empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,11 @@
|
||||
public enum DocumentType
|
||||
{
|
||||
IppScan,
|
||||
DeanConsent,
|
||||
NnwIsurance
|
||||
OutsideTermApproval,
|
||||
InternshipTypeApproval,
|
||||
OutsideSemesterApproval,
|
||||
NnwInsurance,
|
||||
InternshipEvaluation,
|
||||
Other
|
||||
}
|
||||
}
|
@ -22,13 +22,17 @@ namespace InternshipSystem.Core
|
||||
public Validate()
|
||||
{
|
||||
RuleFor(x => x.FirstName)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.mentor.first_name.empty");
|
||||
RuleFor(x => x.LastName)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.mentor.last_name.empty");
|
||||
RuleFor(x => x.Email)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.mentor.email.empty");
|
||||
RuleFor(x => x.PhoneNumber)
|
||||
.NotEmpty();
|
||||
.NotEmpty()
|
||||
.WithMessage("error.mentor.phone_number.empty");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
using InternshipSystem.Core.ValueObject;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InternshipSystem.Repository
|
||||
@ -114,18 +116,29 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Praktyka bezpłatna",
|
||||
LabelEng = "Free internship",
|
||||
Label = "Umowa o organizację praktyki",
|
||||
LabelEng = "Internship agreement",
|
||||
Description = "Praktyka bezpłatna",
|
||||
DescriptionEng = "Free internship",
|
||||
RequireInsurance = true
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Praktyka absolwencka",
|
||||
LabelEng = "Graduate internship",
|
||||
Label = "Umowa o praktykę absolwencką",
|
||||
LabelEng = "Graduate internship agreement",
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Praktyka bezpłatna",
|
||||
LabelEng = "Free apprenticeship",
|
||||
Label = "Umowa o staż bezpłatny",
|
||||
LabelEng = "Free apprenticeship agreement",
|
||||
RequireInsurance = true
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Umowa o staż płatny",
|
||||
LabelEng = "Paid apprenticeship agreement",
|
||||
Description = "np. staż przemysłowy",
|
||||
DescriptionEng = "e.g. industrial apprenticeship",
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
@ -137,17 +150,18 @@ namespace InternshipSystem.Repository
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Umowa o pracę",
|
||||
LabelEng = "contract of employment",
|
||||
LabelEng = "Contract of employment",
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Umowa o dzieło",
|
||||
LabelEng = "contract work",
|
||||
Label = "Umowa o dzieło (w tym B2B)",
|
||||
LabelEng = "Contract work (including B2B)",
|
||||
},
|
||||
new InternshipType
|
||||
{
|
||||
Label = "Umowa zlecenie",
|
||||
LabelEng = "contract of mandate"
|
||||
Label = "Umowa zlecenia (w tym B2B)",
|
||||
LabelEng = "Contract of mandate (including B2B)",
|
||||
RequireDeansApproval = true
|
||||
},
|
||||
};
|
||||
await Context.InternshipTypes.AddRangeAsync(internshipTypes);
|
||||
@ -194,6 +208,7 @@ namespace InternshipSystem.Repository
|
||||
Course = new Course
|
||||
{
|
||||
Name = "Informatyka",
|
||||
NameEng = "Informatics",
|
||||
},
|
||||
AvailableInternshipTypes = new List<EditionInternshipType>
|
||||
{
|
||||
@ -203,19 +218,78 @@ namespace InternshipSystem.Repository
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenie"))
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenia (w tym B2B)"))
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o dzieło"))
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o dzieło (w tym B2B)"))
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Praktyka bezpłatna"))
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o organizację praktyki"))
|
||||
}
|
||||
},
|
||||
Internships = new List<Internship>(),
|
||||
}
|
||||
},
|
||||
new Edition
|
||||
{
|
||||
Id = Guid.Parse("bd0da085-8e51-400d-9630-bdab3f9f6cc8"),
|
||||
EditionStart = new DateTime(2019, 5, 10),
|
||||
EditionFinish = new DateTime(2019, 12, 10),
|
||||
ReportingStart = new DateTime(2019, 9, 30),
|
||||
AvailableSubjects = new List<EditionSubject>
|
||||
{
|
||||
new EditionSubject
|
||||
{
|
||||
Subject = new InternshipSubject
|
||||
{
|
||||
Description = "Modelowanie baz danych",
|
||||
DescriptionEng = "Database modeling",
|
||||
}
|
||||
},
|
||||
new EditionSubject
|
||||
{
|
||||
Subject = new InternshipSubject
|
||||
{
|
||||
Description = "Oprogramowywanie kart graficznych",
|
||||
DescriptionEng = "Graphics card software",
|
||||
}
|
||||
},
|
||||
new EditionSubject
|
||||
{
|
||||
Subject = new InternshipSubject
|
||||
{
|
||||
Description = "Projektowanie UI",
|
||||
DescriptionEng = "UI design",
|
||||
}
|
||||
}
|
||||
},
|
||||
Course = new Course
|
||||
{
|
||||
Name = "Inżynieria Biomedyczna",
|
||||
NameEng = "Biomedical Engineering",
|
||||
},
|
||||
AvailableInternshipTypes = new List<EditionInternshipType>
|
||||
{
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o pracę"))
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenia (w tym B2B)"))
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o dzieło (w tym B2B)"))
|
||||
},
|
||||
new EditionInternshipType
|
||||
{
|
||||
InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o organizację praktyki"))
|
||||
}
|
||||
},
|
||||
Internships = new List<Internship>(),
|
||||
}
|
||||
};
|
||||
|
||||
var edition = editions.First();
|
||||
@ -224,6 +298,14 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
new Internship
|
||||
{
|
||||
Documentation = new List<Document>
|
||||
{
|
||||
new Document
|
||||
{
|
||||
Description = "doc",
|
||||
Type = DocumentType.IppScan
|
||||
}
|
||||
},
|
||||
Student = new Student
|
||||
{
|
||||
FirstName = "Jan",
|
||||
@ -235,6 +317,7 @@ namespace InternshipSystem.Repository
|
||||
{
|
||||
Company = Context.Companies.First(c => c.Name.Equals("Intel")),
|
||||
Type = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o pracę")),
|
||||
SubmissionDate = new DateTime(2000, 6, 2),
|
||||
Start = new DateTime(2000, 7, 1),
|
||||
End = new DateTime(2000, 8, 30),
|
||||
State = DocumentState.Submitted,
|
||||
@ -267,6 +350,7 @@ namespace InternshipSystem.Repository
|
||||
}
|
||||
}
|
||||
},
|
||||
Report = Report.Create()
|
||||
},
|
||||
new Internship
|
||||
{
|
||||
@ -280,7 +364,8 @@ namespace InternshipSystem.Repository
|
||||
InternshipRegistration = new InternshipRegistration
|
||||
{
|
||||
Company = Context.Companies.First(c => c.Name.Equals("Asseco Poland")),
|
||||
Type = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenie")),
|
||||
Type = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenia (w tym B2B)")),
|
||||
SubmissionDate = new DateTime(2000, 6, 1),
|
||||
Start = new DateTime(2000, 7, 1),
|
||||
End = new DateTime(2000, 8, 30),
|
||||
State = DocumentState.Submitted,
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using InternshipSystem.Core;
|
||||
using InternshipSystem.Core.Entity;
|
||||
using InternshipSystem.Core.Entity.Internship;
|
||||
using InternshipSystem.Core.UglyOrmArtifacts;
|
||||
|
||||
@ -12,6 +15,10 @@ namespace InternshipSystem.Repository
|
||||
public DbSet<StaticPage> StaticPages { get; set; }
|
||||
public DbSet<InternshipType> InternshipTypes { get; set; }
|
||||
public DbSet<Student> Students { get; set; }
|
||||
public DbSet<Course> Courses { get; set; }
|
||||
public DbSet<Internship> Internships { get; set; }
|
||||
|
||||
public DbSet<ReportField> ReportFields { get; set; }
|
||||
|
||||
public InternshipDbContext(DbContextOptions<InternshipDbContext> options)
|
||||
: base(options)
|
||||
@ -31,6 +38,16 @@ namespace InternshipSystem.Repository
|
||||
modelBuilder.Entity<InternshipRegistration>()
|
||||
.OwnsOne(ir => ir.Mentor);
|
||||
|
||||
modelBuilder.Entity<DocumentScan>(builder =>
|
||||
{
|
||||
builder
|
||||
.HasKey(scan => scan.DocumentId);
|
||||
|
||||
builder
|
||||
.HasOne(s => s.Document)
|
||||
.WithOne(d => d.Scan);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ProgramSubject>(builder =>
|
||||
{
|
||||
builder
|
||||
@ -78,6 +95,37 @@ namespace InternshipSystem.Repository
|
||||
.WithMany()
|
||||
.HasForeignKey(subject => subject.InternshipSubjectId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ReportFieldEdition>(builder =>
|
||||
{
|
||||
builder
|
||||
.HasKey(e => new {e.EditionId, e.ReportFieldId});
|
||||
|
||||
builder
|
||||
.HasOne(e => e.Edition)
|
||||
.WithMany(edition => edition.ReportSchema)
|
||||
.HasForeignKey(r => r.EditionId);
|
||||
|
||||
builder
|
||||
.HasOne(e => e.Field)
|
||||
.WithMany()
|
||||
.HasForeignKey(r => r.ReportFieldId);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ReportField>()
|
||||
.HasDiscriminator<string>("field_discrimnator")
|
||||
.HasValue<ReportField>("single")
|
||||
.HasValue<ReportChoiceField>("choice");
|
||||
|
||||
modelBuilder.Entity<ReportChoiceField>()
|
||||
.Property(r => r.Choices)
|
||||
.HasConversion(
|
||||
a => string.Join('#', a),
|
||||
s => s.Split('#', StringSplitOptions.RemoveEmptyEntries));
|
||||
|
||||
modelBuilder.Entity<Report>()
|
||||
.Property(r => r.Value)
|
||||
.HasColumnType("jsonb");
|
||||
}
|
||||
}
|
||||
}
|
@ -20,8 +20,4 @@
|
||||
<ProjectReference Include="..\InternshipSystem.Core\InternshipSystem.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -10,8 +10,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(InternshipDbContext))]
|
||||
[Migration("20201015165238_init")]
|
||||
partial class init
|
||||
[Migration("20210110210810_Init")]
|
||||
partial class Init
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -72,24 +72,6 @@ namespace InternshipSystem.Repository.Migrations
|
||||
b.ToTable("companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Course", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_course");
|
||||
|
||||
b.ToTable("course");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -98,6 +80,10 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
@ -106,18 +92,6 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnName("internship_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("InternshipId1")
|
||||
.HasColumnName("internship_id1")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("RejectionReason")
|
||||
.HasColumnName("rejection_reason")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<byte[]>("Scan")
|
||||
.HasColumnName("scan")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
@ -132,12 +106,37 @@ namespace InternshipSystem.Repository.Migrations
|
||||
b.HasIndex("InternshipId")
|
||||
.HasName("ix_document_internship_id");
|
||||
|
||||
b.HasIndex("InternshipId1")
|
||||
.HasName("ix_document_internship_id1");
|
||||
|
||||
b.ToTable("document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.Property<long>("DocumentId")
|
||||
.HasColumnName("document_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<byte[]>("File")
|
||||
.HasColumnName("file")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("Filename")
|
||||
.HasColumnName("filename")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Mime")
|
||||
.HasColumnName("mime")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnName("size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("DocumentId")
|
||||
.HasName("pk_document_scan");
|
||||
|
||||
b.ToTable("document_scan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@ -170,6 +169,28 @@ namespace InternshipSystem.Repository.Migrations
|
||||
b.ToTable("editions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Course", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NameEng")
|
||||
.HasColumnName("name_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_courses");
|
||||
|
||||
b.ToTable("courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -199,21 +220,21 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship");
|
||||
.HasName("pk_internships");
|
||||
|
||||
b.HasIndex("EditionId")
|
||||
.HasName("ix_internship_edition_id");
|
||||
.HasName("ix_internships_edition_id");
|
||||
|
||||
b.HasIndex("InternshipRegistrationId")
|
||||
.HasName("ix_internship_internship_registration_id");
|
||||
.HasName("ix_internships_internship_registration_id");
|
||||
|
||||
b.HasIndex("ReportId")
|
||||
.HasName("ix_internship_report_id");
|
||||
.HasName("ix_internships_report_id");
|
||||
|
||||
b.HasIndex("StudentId")
|
||||
.HasName("ix_internship_student_id");
|
||||
.HasName("ix_internships_student_id");
|
||||
|
||||
b.ToTable("internship");
|
||||
b.ToTable("internships");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
@ -228,6 +249,10 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnName("branch_address_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long?>("CompanyId")
|
||||
.HasColumnName("company_id")
|
||||
.HasColumnType("bigint");
|
||||
@ -248,6 +273,10 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("SubmissionDate")
|
||||
.HasColumnName("submission_date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<long?>("TypeId")
|
||||
.HasColumnName("type_id")
|
||||
.HasColumnType("bigint");
|
||||
@ -313,12 +342,57 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("RequireDeansApproval")
|
||||
.HasColumnName("require_deans_approval")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_types");
|
||||
|
||||
b.ToTable("internship_types");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportField", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FieldType")
|
||||
.HasColumnName("field_type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasColumnName("label")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LabelEng")
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("field_discrimnator")
|
||||
.IsRequired()
|
||||
.HasColumnName("field_discrimnator")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report_fields");
|
||||
|
||||
b.ToTable("report_fields");
|
||||
|
||||
b.HasDiscriminator<string>("field_discrimnator").HasValue("single");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@ -327,18 +401,14 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("Range")
|
||||
.HasColumnName("range")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("SiteAddress")
|
||||
.HasColumnName("site_address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnName("value")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report");
|
||||
|
||||
@ -474,6 +544,36 @@ namespace InternshipSystem.Repository.Migrations
|
||||
b.ToTable("program_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("ReportFieldId")
|
||||
.HasColumnName("report_field_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "ReportFieldId")
|
||||
.HasName("pk_report_field_edition");
|
||||
|
||||
b.HasIndex("ReportFieldId")
|
||||
.HasName("ix_report_field_edition_report_field_id");
|
||||
|
||||
b.ToTable("report_field_edition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportChoiceField", b =>
|
||||
{
|
||||
b.HasBaseType("InternshipSystem.Core.Entity.ReportField");
|
||||
|
||||
b.Property<string>("Choices")
|
||||
.HasColumnName("choices")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasDiscriminator().HasValue("choice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Company", null)
|
||||
@ -522,23 +622,28 @@ namespace InternshipSystem.Repository.Migrations
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||
.WithMany("Approvals")
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internship_internship_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||
.WithMany("Documentation")
|
||||
.HasForeignKey("InternshipId1")
|
||||
.HasConstraintName("fk_document_internship_internship_id1");
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internships_internship_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Document", "Document")
|
||||
.WithOne("Scan")
|
||||
.HasForeignKey("InternshipSystem.Core.DocumentScan", "DocumentId")
|
||||
.HasConstraintName("fk_document_scan_document_document_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Course", "Course")
|
||||
b.HasOne("InternshipSystem.Core.Entity.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId")
|
||||
.HasConstraintName("fk_editions_course_course_id");
|
||||
.HasConstraintName("fk_editions_courses_course_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
@ -546,22 +651,22 @@ namespace InternshipSystem.Repository.Migrations
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("Internships")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_internship_editions_edition_id");
|
||||
.HasConstraintName("fk_internships_editions_edition_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_internship_internship_registration_internship_registration_");
|
||||
.HasConstraintName("fk_internships_internship_registration_internship_registration");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Report", "Report")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportId")
|
||||
.HasConstraintName("fk_internship_report_report_id");
|
||||
.HasConstraintName("fk_internships_report_report_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Student", "Student")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudentId")
|
||||
.HasConstraintName("fk_internship_students_student_id");
|
||||
.HasConstraintName("fk_internships_students_student_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
@ -666,6 +771,23 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("ReportSchema")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_report_field_edition_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.ReportField", "Field")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportFieldId")
|
||||
.HasConstraintName("fk_report_field_edition_report_fields_report_field_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
public partial class init : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
@ -24,16 +24,17 @@ namespace InternshipSystem.Repository.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "course",
|
||||
name: "courses",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
name = table.Column<string>(nullable: true)
|
||||
name = table.Column<string>(nullable: true),
|
||||
name_eng = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_course", x => x.id);
|
||||
table.PrimaryKey("pk_courses", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -59,7 +60,8 @@ namespace InternshipSystem.Repository.Migrations
|
||||
label = table.Column<string>(nullable: true),
|
||||
label_eng = table.Column<string>(nullable: true),
|
||||
description = table.Column<string>(nullable: true),
|
||||
description_eng = table.Column<string>(nullable: true)
|
||||
description_eng = table.Column<string>(nullable: true),
|
||||
require_deans_approval = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -73,14 +75,32 @@ namespace InternshipSystem.Repository.Migrations
|
||||
id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
state = table.Column<int>(nullable: false),
|
||||
range = table.Column<int>(nullable: false),
|
||||
site_address = table.Column<string>(nullable: true)
|
||||
value = table.Column<string>(type: "jsonb", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_report", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "report_fields",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
label = table.Column<string>(nullable: true),
|
||||
label_eng = table.Column<string>(nullable: true),
|
||||
description = table.Column<string>(nullable: true),
|
||||
description_eng = table.Column<string>(nullable: true),
|
||||
field_type = table.Column<int>(nullable: false),
|
||||
field_discrimnator = table.Column<string>(nullable: false),
|
||||
choices = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_report_fields", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "static_pages",
|
||||
columns: table => new
|
||||
@ -155,9 +175,9 @@ namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
table.PrimaryKey("pk_editions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_editions_course_course_id",
|
||||
name: "fk_editions_courses_course_id",
|
||||
column: x => x.course_id,
|
||||
principalTable: "course",
|
||||
principalTable: "courses",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
@ -170,6 +190,7 @@ namespace InternshipSystem.Repository.Migrations
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
company_id = table.Column<long>(nullable: true),
|
||||
branch_address_id = table.Column<long>(nullable: true),
|
||||
submission_date = table.Column<DateTime>(nullable: false),
|
||||
start = table.Column<DateTime>(nullable: false),
|
||||
end = table.Column<DateTime>(nullable: false),
|
||||
first_name = table.Column<string>(nullable: true),
|
||||
@ -178,7 +199,8 @@ namespace InternshipSystem.Repository.Migrations
|
||||
phone_number = table.Column<string>(nullable: true),
|
||||
type_id = table.Column<long>(nullable: true),
|
||||
declared_hours = table.Column<int>(nullable: false),
|
||||
state = table.Column<int>(nullable: false)
|
||||
state = table.Column<int>(nullable: false),
|
||||
change_state_comment = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -252,7 +274,31 @@ namespace InternshipSystem.Repository.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "internship",
|
||||
name: "report_field_edition",
|
||||
columns: table => new
|
||||
{
|
||||
edition_id = table.Column<Guid>(nullable: false),
|
||||
report_field_id = table.Column<long>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_report_field_edition", x => new { x.edition_id, x.report_field_id });
|
||||
table.ForeignKey(
|
||||
name: "fk_report_field_edition_editions_edition_id",
|
||||
column: x => x.edition_id,
|
||||
principalTable: "editions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_report_field_edition_report_fields_report_field_id",
|
||||
column: x => x.report_field_id,
|
||||
principalTable: "report_fields",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "internships",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(nullable: false)
|
||||
@ -265,27 +311,27 @@ namespace InternshipSystem.Repository.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_internship", x => x.id);
|
||||
table.PrimaryKey("pk_internships", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_internship_editions_edition_id",
|
||||
name: "fk_internships_editions_edition_id",
|
||||
column: x => x.edition_id,
|
||||
principalTable: "editions",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_internship_internship_registration_internship_registration_",
|
||||
name: "fk_internships_internship_registration_internship_registration",
|
||||
column: x => x.internship_registration_id,
|
||||
principalTable: "internship_registration",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_internship_report_report_id",
|
||||
name: "fk_internships_report_report_id",
|
||||
column: x => x.report_id,
|
||||
principalTable: "report",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "fk_internship_students_student_id",
|
||||
name: "fk_internships_students_student_id",
|
||||
column: x => x.student_id,
|
||||
principalTable: "students",
|
||||
principalColumn: "id",
|
||||
@ -323,28 +369,41 @@ namespace InternshipSystem.Repository.Migrations
|
||||
id = table.Column<long>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
description = table.Column<string>(nullable: true),
|
||||
scan = table.Column<byte[]>(nullable: true),
|
||||
type = table.Column<int>(nullable: false),
|
||||
state = table.Column<int>(nullable: false),
|
||||
rejection_reason = table.Column<string>(nullable: true),
|
||||
internship_id = table.Column<long>(nullable: true),
|
||||
internship_id1 = table.Column<long>(nullable: true)
|
||||
change_state_comment = table.Column<string>(nullable: true),
|
||||
internship_id = table.Column<long>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_document", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_document_internship_internship_id",
|
||||
name: "fk_document_internships_internship_id",
|
||||
column: x => x.internship_id,
|
||||
principalTable: "internship",
|
||||
principalTable: "internships",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "document_scan",
|
||||
columns: table => new
|
||||
{
|
||||
document_id = table.Column<long>(nullable: false),
|
||||
size = table.Column<long>(nullable: false),
|
||||
filename = table.Column<string>(nullable: true),
|
||||
mime = table.Column<string>(nullable: true),
|
||||
file = table.Column<byte[]>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_document_scan", x => x.document_id);
|
||||
table.ForeignKey(
|
||||
name: "fk_document_internship_internship_id1",
|
||||
column: x => x.internship_id1,
|
||||
principalTable: "internship",
|
||||
name: "fk_document_scan_document_document_id",
|
||||
column: x => x.document_id,
|
||||
principalTable: "document",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
@ -357,11 +416,6 @@ namespace InternshipSystem.Repository.Migrations
|
||||
table: "document",
|
||||
column: "internship_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_document_internship_id1",
|
||||
table: "document",
|
||||
column: "internship_id1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_edition_internship_type_internship_type_id",
|
||||
table: "edition_internship_type",
|
||||
@ -377,26 +431,6 @@ namespace InternshipSystem.Repository.Migrations
|
||||
table: "editions",
|
||||
column: "course_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internship_edition_id",
|
||||
table: "internship",
|
||||
column: "edition_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internship_internship_registration_id",
|
||||
table: "internship",
|
||||
column: "internship_registration_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internship_report_id",
|
||||
table: "internship",
|
||||
column: "report_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internship_student_id",
|
||||
table: "internship",
|
||||
column: "student_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internship_registration_branch_address_id",
|
||||
table: "internship_registration",
|
||||
@ -412,16 +446,41 @@ namespace InternshipSystem.Repository.Migrations
|
||||
table: "internship_registration",
|
||||
column: "type_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internships_edition_id",
|
||||
table: "internships",
|
||||
column: "edition_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internships_internship_registration_id",
|
||||
table: "internships",
|
||||
column: "internship_registration_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internships_report_id",
|
||||
table: "internships",
|
||||
column: "report_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_internships_student_id",
|
||||
table: "internships",
|
||||
column: "student_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_program_subject_internship_subject_id",
|
||||
table: "program_subject",
|
||||
column: "internship_subject_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_report_field_edition_report_field_id",
|
||||
table: "report_field_edition",
|
||||
column: "report_field_id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "document");
|
||||
name: "document_scan");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "edition_internship_type");
|
||||
@ -432,15 +491,24 @@ namespace InternshipSystem.Repository.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "program_subject");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "report_field_edition");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "static_pages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "internship");
|
||||
name: "document");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "internship_subject");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "report_fields");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "internships");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "editions");
|
||||
|
||||
@ -454,7 +522,7 @@ namespace InternshipSystem.Repository.Migrations
|
||||
name: "students");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "course");
|
||||
name: "courses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "branch_office");
|
798
src/InternshipSystem.Repository/Migrations/20210111195519_Insurance.Designer.cs
generated
Normal file
798
src/InternshipSystem.Repository/Migrations/20210111195519_Insurance.Designer.cs
generated
Normal file
@ -0,0 +1,798 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(InternshipDbContext))]
|
||||
[Migration("20210111195519_Insurance")]
|
||||
partial class Insurance
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.HasAnnotation("ProductVersion", "3.1.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<long?>("CompanyId")
|
||||
.HasColumnName("company_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("Provider")
|
||||
.HasColumnName("provider")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_branch_office");
|
||||
|
||||
b.HasIndex("CompanyId")
|
||||
.HasName("ix_branch_office_company_id");
|
||||
|
||||
b.ToTable("branch_office");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Nip")
|
||||
.HasColumnName("nip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("Provider")
|
||||
.HasColumnName("provider")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_companies");
|
||||
|
||||
b.ToTable("companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long?>("InternshipId")
|
||||
.HasColumnName("internship_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnName("type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_document");
|
||||
|
||||
b.HasIndex("InternshipId")
|
||||
.HasName("ix_document_internship_id");
|
||||
|
||||
b.ToTable("document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.Property<long>("DocumentId")
|
||||
.HasColumnName("document_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<byte[]>("File")
|
||||
.HasColumnName("file")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("Filename")
|
||||
.HasColumnName("filename")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Mime")
|
||||
.HasColumnName("mime")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnName("size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("DocumentId")
|
||||
.HasName("pk_document_scan");
|
||||
|
||||
b.ToTable("document_scan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long?>("CourseId")
|
||||
.HasColumnName("course_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("EditionFinish")
|
||||
.HasColumnName("edition_finish")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("EditionStart")
|
||||
.HasColumnName("edition_start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("ReportingStart")
|
||||
.HasColumnName("reporting_start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_editions");
|
||||
|
||||
b.HasIndex("CourseId")
|
||||
.HasName("ix_editions_course_id");
|
||||
|
||||
b.ToTable("editions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Course", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NameEng")
|
||||
.HasColumnName("name_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_courses");
|
||||
|
||||
b.ToTable("courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<Guid?>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<float?>("Grade")
|
||||
.HasColumnName("grade")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<long?>("InternshipRegistrationId")
|
||||
.HasColumnName("internship_registration_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("ReportId")
|
||||
.HasColumnName("report_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("StudentId")
|
||||
.HasColumnName("student_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internships");
|
||||
|
||||
b.HasIndex("EditionId")
|
||||
.HasName("ix_internships_edition_id");
|
||||
|
||||
b.HasIndex("InternshipRegistrationId")
|
||||
.HasName("ix_internships_internship_registration_id");
|
||||
|
||||
b.HasIndex("ReportId")
|
||||
.HasName("ix_internships_report_id");
|
||||
|
||||
b.HasIndex("StudentId")
|
||||
.HasName("ix_internships_student_id");
|
||||
|
||||
b.ToTable("internships");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<long?>("BranchAddressId")
|
||||
.HasColumnName("branch_address_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long?>("CompanyId")
|
||||
.HasColumnName("company_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DeclaredHours")
|
||||
.HasColumnName("declared_hours")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("End")
|
||||
.HasColumnName("end")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("Start")
|
||||
.HasColumnName("start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("SubmissionDate")
|
||||
.HasColumnName("submission_date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<long?>("TypeId")
|
||||
.HasColumnName("type_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_registration");
|
||||
|
||||
b.HasIndex("BranchAddressId")
|
||||
.HasName("ix_internship_registration_branch_address_id");
|
||||
|
||||
b.HasIndex("CompanyId")
|
||||
.HasName("ix_internship_registration_company_id");
|
||||
|
||||
b.HasIndex("TypeId")
|
||||
.HasName("ix_internship_registration_type_id");
|
||||
|
||||
b.ToTable("internship_registration");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_subject");
|
||||
|
||||
b.ToTable("internship_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasColumnName("label")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LabelEng")
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("RequireDeansApproval")
|
||||
.HasColumnName("require_deans_approval")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("RequireInsurance")
|
||||
.HasColumnName("require_insurance")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_types");
|
||||
|
||||
b.ToTable("internship_types");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportField", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FieldType")
|
||||
.HasColumnName("field_type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasColumnName("label")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LabelEng")
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("field_discrimnator")
|
||||
.IsRequired()
|
||||
.HasColumnName("field_discrimnator")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report_fields");
|
||||
|
||||
b.ToTable("report_fields");
|
||||
|
||||
b.HasDiscriminator<string>("field_discrimnator").HasValue("single");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnName("value")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report");
|
||||
|
||||
b.ToTable("report");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.StaticPage", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("AccessName")
|
||||
.HasColumnName("access_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnName("content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ContentEng")
|
||||
.HasColumnName("content_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnName("title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleEng")
|
||||
.HasColumnName("title_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_static_pages");
|
||||
|
||||
b.ToTable("static_pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Student", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("AlbumNumber")
|
||||
.HasColumnName("album_number")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Course")
|
||||
.HasColumnName("course")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnName("email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasColumnName("first_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasColumnName("last_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Semester")
|
||||
.HasColumnName("semester")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_students");
|
||||
|
||||
b.ToTable("students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipTypeId")
|
||||
.HasColumnName("internship_type_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipTypeId")
|
||||
.HasName("pk_edition_internship_type");
|
||||
|
||||
b.HasIndex("InternshipTypeId")
|
||||
.HasName("ix_edition_internship_type_internship_type_id");
|
||||
|
||||
b.ToTable("edition_internship_type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipSubjectId")
|
||||
.HasName("pk_edition_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_edition_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("edition_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.Property<long>("InternshipRegistrationId")
|
||||
.HasColumnName("internship_registration_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("InternshipRegistrationId", "InternshipSubjectId")
|
||||
.HasName("pk_program_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_program_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("program_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("ReportFieldId")
|
||||
.HasColumnName("report_field_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "ReportFieldId")
|
||||
.HasName("pk_report_field_edition");
|
||||
|
||||
b.HasIndex("ReportFieldId")
|
||||
.HasName("ix_report_field_edition_report_field_id");
|
||||
|
||||
b.ToTable("report_field_edition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportChoiceField", b =>
|
||||
{
|
||||
b.HasBaseType("InternshipSystem.Core.Entity.ReportField");
|
||||
|
||||
b.Property<string>("Choices")
|
||||
.HasColumnName("choices")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasDiscriminator().HasValue("choice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Company", null)
|
||||
.WithMany("Branches")
|
||||
.HasForeignKey("CompanyId")
|
||||
.HasConstraintName("fk_branch_office_companies_company_id");
|
||||
|
||||
b.OwnsOne("InternshipSystem.Core.BranchAddress", "Address", b1 =>
|
||||
{
|
||||
b1.Property<long>("BranchOfficeId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b1.Property<string>("Building")
|
||||
.HasColumnName("building")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("City")
|
||||
.HasColumnName("city")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("Country")
|
||||
.HasColumnName("country")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("PostalCode")
|
||||
.HasColumnName("postal_code")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("Street")
|
||||
.HasColumnName("street")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.HasKey("BranchOfficeId")
|
||||
.HasName("pk_branch_office");
|
||||
|
||||
b1.ToTable("branch_office");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BranchOfficeId")
|
||||
.HasConstraintName("fk_branch_address_branch_office_branch_office_id");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||
.WithMany("Documentation")
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internships_internship_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Document", "Document")
|
||||
.WithOne("Scan")
|
||||
.HasForeignKey("InternshipSystem.Core.DocumentScan", "DocumentId")
|
||||
.HasConstraintName("fk_document_scan_document_document_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId")
|
||||
.HasConstraintName("fk_editions_courses_course_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("Internships")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_internships_editions_edition_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_internships_internship_registration_internship_registration");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Report", "Report")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportId")
|
||||
.HasConstraintName("fk_internships_report_report_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Student", "Student")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudentId")
|
||||
.HasConstraintName("fk_internships_students_student_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("BranchAddressId")
|
||||
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Company", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("CompanyId")
|
||||
.HasConstraintName("fk_internship_registration_companies_company_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
||||
.WithMany()
|
||||
.HasForeignKey("TypeId")
|
||||
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
||||
|
||||
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
||||
{
|
||||
b1.Property<long>("InternshipRegistrationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.HasColumnName("email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("FirstName")
|
||||
.HasColumnName("first_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("LastName")
|
||||
.HasColumnName("last_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.HasColumnName("phone_number")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.HasKey("InternshipRegistrationId")
|
||||
.HasName("pk_internship_registration");
|
||||
|
||||
b1.ToTable("internship_registration");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_mentor_internship_registration_internship_registration_id");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("AvailableInternshipTypes")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_internship_type_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "InternshipType")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipTypeId")
|
||||
.HasConstraintName("fk_edition_internship_type_internship_types_internship_type_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("AvailableSubjects")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_subject_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "Registration")
|
||||
.WithMany("Subjects")
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("ReportSchema")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_report_field_edition_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.ReportField", "Field")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportFieldId")
|
||||
.HasConstraintName("fk_report_field_edition_report_fields_report_field_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
public partial class Insurance : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "require_insurance",
|
||||
table: "internship_types",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "require_insurance",
|
||||
table: "internship_types");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,796 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using InternshipSystem.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace InternshipSystem.Repository.Migrations
|
||||
{
|
||||
[DbContext(typeof(InternshipDbContext))]
|
||||
partial class InternshipDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.HasAnnotation("ProductVersion", "3.1.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<long?>("CompanyId")
|
||||
.HasColumnName("company_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("Provider")
|
||||
.HasColumnName("provider")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_branch_office");
|
||||
|
||||
b.HasIndex("CompanyId")
|
||||
.HasName("ix_branch_office_company_id");
|
||||
|
||||
b.ToTable("branch_office");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Company", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Nip")
|
||||
.HasColumnName("nip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("Provider")
|
||||
.HasColumnName("provider")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_companies");
|
||||
|
||||
b.ToTable("companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long?>("InternshipId")
|
||||
.HasColumnName("internship_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnName("type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_document");
|
||||
|
||||
b.HasIndex("InternshipId")
|
||||
.HasName("ix_document_internship_id");
|
||||
|
||||
b.ToTable("document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.Property<long>("DocumentId")
|
||||
.HasColumnName("document_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<byte[]>("File")
|
||||
.HasColumnName("file")
|
||||
.HasColumnType("bytea");
|
||||
|
||||
b.Property<string>("Filename")
|
||||
.HasColumnName("filename")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Mime")
|
||||
.HasColumnName("mime")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnName("size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("DocumentId")
|
||||
.HasName("pk_document_scan");
|
||||
|
||||
b.ToTable("document_scan");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long?>("CourseId")
|
||||
.HasColumnName("course_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("EditionFinish")
|
||||
.HasColumnName("edition_finish")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("EditionStart")
|
||||
.HasColumnName("edition_start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("ReportingStart")
|
||||
.HasColumnName("reporting_start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_editions");
|
||||
|
||||
b.HasIndex("CourseId")
|
||||
.HasName("ix_editions_course_id");
|
||||
|
||||
b.ToTable("editions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Course", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnName("name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NameEng")
|
||||
.HasColumnName("name_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_courses");
|
||||
|
||||
b.ToTable("courses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<Guid?>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<float?>("Grade")
|
||||
.HasColumnName("grade")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<long?>("InternshipRegistrationId")
|
||||
.HasColumnName("internship_registration_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("ReportId")
|
||||
.HasColumnName("report_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("StudentId")
|
||||
.HasColumnName("student_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internships");
|
||||
|
||||
b.HasIndex("EditionId")
|
||||
.HasName("ix_internships_edition_id");
|
||||
|
||||
b.HasIndex("InternshipRegistrationId")
|
||||
.HasName("ix_internships_internship_registration_id");
|
||||
|
||||
b.HasIndex("ReportId")
|
||||
.HasName("ix_internships_report_id");
|
||||
|
||||
b.HasIndex("StudentId")
|
||||
.HasName("ix_internships_student_id");
|
||||
|
||||
b.ToTable("internships");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<long?>("BranchAddressId")
|
||||
.HasColumnName("branch_address_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ChangeStateComment")
|
||||
.HasColumnName("change_state_comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long?>("CompanyId")
|
||||
.HasColumnName("company_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("DeclaredHours")
|
||||
.HasColumnName("declared_hours")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("End")
|
||||
.HasColumnName("end")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<DateTime>("Start")
|
||||
.HasColumnName("start")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("SubmissionDate")
|
||||
.HasColumnName("submission_date")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<long?>("TypeId")
|
||||
.HasColumnName("type_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_registration");
|
||||
|
||||
b.HasIndex("BranchAddressId")
|
||||
.HasName("ix_internship_registration_branch_address_id");
|
||||
|
||||
b.HasIndex("CompanyId")
|
||||
.HasName("ix_internship_registration_company_id");
|
||||
|
||||
b.HasIndex("TypeId")
|
||||
.HasName("ix_internship_registration_type_id");
|
||||
|
||||
b.ToTable("internship_registration");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipSubject", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_subject");
|
||||
|
||||
b.ToTable("internship_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipType", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasColumnName("label")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LabelEng")
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("RequireDeansApproval")
|
||||
.HasColumnName("require_deans_approval")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("RequireInsurance")
|
||||
.HasColumnName("require_insurance")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_internship_types");
|
||||
|
||||
b.ToTable("internship_types");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportField", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnName("description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DescriptionEng")
|
||||
.HasColumnName("description_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FieldType")
|
||||
.HasColumnName("field_type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasColumnName("label")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LabelEng")
|
||||
.HasColumnName("label_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("field_discrimnator")
|
||||
.IsRequired()
|
||||
.HasColumnName("field_discrimnator")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report_fields");
|
||||
|
||||
b.ToTable("report_fields");
|
||||
|
||||
b.HasDiscriminator<string>("field_discrimnator").HasValue("single");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Report", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnName("state")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnName("value")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_report");
|
||||
|
||||
b.ToTable("report");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.StaticPage", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("AccessName")
|
||||
.HasColumnName("access_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnName("content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ContentEng")
|
||||
.HasColumnName("content_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnName("title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TitleEng")
|
||||
.HasColumnName("title_eng")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_static_pages");
|
||||
|
||||
b.ToTable("static_pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Student", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("AlbumNumber")
|
||||
.HasColumnName("album_number")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Course")
|
||||
.HasColumnName("course")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnName("email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasColumnName("first_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasColumnName("last_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Semester")
|
||||
.HasColumnName("semester")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_students");
|
||||
|
||||
b.ToTable("students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipTypeId")
|
||||
.HasColumnName("internship_type_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipTypeId")
|
||||
.HasName("pk_edition_internship_type");
|
||||
|
||||
b.HasIndex("InternshipTypeId")
|
||||
.HasName("ix_edition_internship_type_internship_type_id");
|
||||
|
||||
b.ToTable("edition_internship_type");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "InternshipSubjectId")
|
||||
.HasName("pk_edition_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_edition_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("edition_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.Property<long>("InternshipRegistrationId")
|
||||
.HasColumnName("internship_registration_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InternshipSubjectId")
|
||||
.HasColumnName("internship_subject_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("InternshipRegistrationId", "InternshipSubjectId")
|
||||
.HasName("pk_program_subject");
|
||||
|
||||
b.HasIndex("InternshipSubjectId")
|
||||
.HasName("ix_program_subject_internship_subject_id");
|
||||
|
||||
b.ToTable("program_subject");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.Property<Guid>("EditionId")
|
||||
.HasColumnName("edition_id")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("ReportFieldId")
|
||||
.HasColumnName("report_field_id")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("EditionId", "ReportFieldId")
|
||||
.HasName("pk_report_field_edition");
|
||||
|
||||
b.HasIndex("ReportFieldId")
|
||||
.HasName("ix_report_field_edition_report_field_id");
|
||||
|
||||
b.ToTable("report_field_edition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.ReportChoiceField", b =>
|
||||
{
|
||||
b.HasBaseType("InternshipSystem.Core.Entity.ReportField");
|
||||
|
||||
b.Property<string>("Choices")
|
||||
.HasColumnName("choices")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasDiscriminator().HasValue("choice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.BranchOffice", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Company", null)
|
||||
.WithMany("Branches")
|
||||
.HasForeignKey("CompanyId")
|
||||
.HasConstraintName("fk_branch_office_companies_company_id");
|
||||
|
||||
b.OwnsOne("InternshipSystem.Core.BranchAddress", "Address", b1 =>
|
||||
{
|
||||
b1.Property<long>("BranchOfficeId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b1.Property<string>("Building")
|
||||
.HasColumnName("building")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("City")
|
||||
.HasColumnName("city")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("Country")
|
||||
.HasColumnName("country")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("PostalCode")
|
||||
.HasColumnName("postal_code")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("Street")
|
||||
.HasColumnName("street")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.HasKey("BranchOfficeId")
|
||||
.HasName("pk_branch_office");
|
||||
|
||||
b1.ToTable("branch_office");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("BranchOfficeId")
|
||||
.HasConstraintName("fk_branch_address_branch_office_branch_office_id");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Document", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.Internship", null)
|
||||
.WithMany("Documentation")
|
||||
.HasForeignKey("InternshipId")
|
||||
.HasConstraintName("fk_document_internships_internship_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.DocumentScan", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Document", "Document")
|
||||
.WithOne("Scan")
|
||||
.HasForeignKey("InternshipSystem.Core.DocumentScan", "DocumentId")
|
||||
.HasConstraintName("fk_document_scan_document_document_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Edition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Course", "Course")
|
||||
.WithMany()
|
||||
.HasForeignKey("CourseId")
|
||||
.HasConstraintName("fk_editions_courses_course_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.Internship", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("Internships")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_internships_editions_edition_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "InternshipRegistration")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_internships_internship_registration_internship_registration");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Report", "Report")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportId")
|
||||
.HasConstraintName("fk_internships_report_report_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Student", "Student")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudentId")
|
||||
.HasConstraintName("fk_internships_students_student_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.Entity.Internship.InternshipRegistration", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.BranchOffice", "BranchAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("BranchAddressId")
|
||||
.HasConstraintName("fk_internship_registration_branch_office_branch_address_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Company", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("CompanyId")
|
||||
.HasConstraintName("fk_internship_registration_companies_company_id");
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "Type")
|
||||
.WithMany()
|
||||
.HasForeignKey("TypeId")
|
||||
.HasConstraintName("fk_internship_registration_internship_types_type_id");
|
||||
|
||||
b.OwnsOne("InternshipSystem.Core.Mentor", "Mentor", b1 =>
|
||||
{
|
||||
b1.Property<long>("InternshipRegistrationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnName("id")
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.HasColumnName("email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("FirstName")
|
||||
.HasColumnName("first_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("LastName")
|
||||
.HasColumnName("last_name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.HasColumnName("phone_number")
|
||||
.HasColumnType("text");
|
||||
|
||||
b1.HasKey("InternshipRegistrationId")
|
||||
.HasName("pk_internship_registration");
|
||||
|
||||
b1.ToTable("internship_registration");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_mentor_internship_registration_internship_registration_id");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionInternshipType", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("AvailableInternshipTypes")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_internship_type_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipType", "InternshipType")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipTypeId")
|
||||
.HasConstraintName("fk_edition_internship_type_internship_types_internship_type_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.EditionSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("AvailableSubjects")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_edition_subject_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_edition_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ProgramSubject", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipRegistration", "Registration")
|
||||
.WithMany("Subjects")
|
||||
.HasForeignKey("InternshipRegistrationId")
|
||||
.HasConstraintName("fk_program_subject_internship_registration_internship_registrat")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.Internship.InternshipSubject", "Subject")
|
||||
.WithMany()
|
||||
.HasForeignKey("InternshipSubjectId")
|
||||
.HasConstraintName("fk_program_subject_internship_subject_internship_subject_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InternshipSystem.Core.UglyOrmArtifacts.ReportFieldEdition", b =>
|
||||
{
|
||||
b.HasOne("InternshipSystem.Core.Edition", "Edition")
|
||||
.WithMany("ReportSchema")
|
||||
.HasForeignKey("EditionId")
|
||||
.HasConstraintName("fk_report_field_edition_editions_edition_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("InternshipSystem.Core.Entity.ReportField", "Field")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReportFieldId")
|
||||
.HasConstraintName("fk_report_field_edition_report_fields_report_field_id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -123,7 +123,6 @@ namespace InternshipSystem.Api.Test
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.ThenInclude(c => c.Subjects)
|
||||
.Where(i => i.Student.Id == user.PersonNumber)
|
||||
.Select(i => i.InternshipRegistration)
|
||||
.First();
|
||||
|
||||
var useCase = new UpdateInternshipRegistrationUseCase(db, ir, ed, user);
|
||||
@ -161,7 +160,6 @@ namespace InternshipSystem.Api.Test
|
||||
.Include(i => i.InternshipRegistration)
|
||||
.ThenInclude(c => c.Subjects)
|
||||
.Where(i => i.Student.Id == user.PersonNumber)
|
||||
.Select(i => i.InternshipRegistration)
|
||||
.First();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user