Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • aasmuha/tdt4242-base
  • sebastvi/tdt4242-base
  • haavafar/tdt4242-base
  • tdt4242-spring-2021-t17/tdt4242-base
  • tmwang/tdt4242-base
  • tdt4242-group-t4/tdt4242-base
  • andstorh/tdt4242-base
  • reaas/tdt4242-base
  • andrerim/tdt4242-base
  • kristohh/tdt4242-base
  • andreajj/tdt4242-base
  • vegarms/tdt4242-base
  • andrend/tdt4242-base
  • haavarhu/tdt4242-base
  • mathilah/tdt4242-base
  • tmmothe/tdt4242-base
  • miriams/tdt4242-base
  • harkamas/tdt4242-base
  • chrisclo/tdt-4242-group-13
  • estherv/tdt4242-base
  • mariueng/tdt-4242-secfit
  • haakogun/secfit-haakon
  • haakonrj/tdt-4242-35
  • tdt4242-group-5/secfit
  • haakonjf/tdt-4242-gruppe6
  • nikolard/tdt-4242-sec-fit
  • tdt4242-gr24/tdt4242-base
  • abdulfaa/tdt4242-base
  • jmjohnse/tdt-4242-group-37-use
  • owengg/tdt-4242-base-owen-forked
  • ktsiow/tdt4242-base
  • olechrib/tdt4242-group16
  • eytan/tdt-4242-base-group-33
33 results
Show changes
Commits on Source (54)
Showing
with 699 additions and 93 deletions
node_modules
backend/secfit/.vscode/
backend/secfit/*/migrations/__pycache__/
backend/secfit/*/__pycache__/
......
stages:
- format
- test
- staging
format:
image: node
stage: format
script:
- npx prettier --check frontend/
test:
image: python:3.8
stage: test
script:
# this configures Django application to use attached postgres database that is run on `postgres` host
- cd backend/secfit
- apt-get update -qy
- pip install -r requirements.txt
image: python:3.8
stage: test
script:
# this configures Django application to use attached postgres database that is run on `postgres` host
- cd backend/secfit
- apt-get update -qy
- pip install -r requirements.txt
- python manage.py test
staging:
type: deploy
image: ruby
stage: staging
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=<your-frontend-app-name> --api-key=$HEROKU_STAGING_API_KEY
- dpl --provider=heroku --app=<your-backend-app-name> --api-key=$HEROKU_STAGING_API_KEY
only:
- master
type: deploy
image: ruby
stage: staging
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=tdt4242-group-5-frontend --api-key=$HEROKU_STAGING_API_KEY
- dpl --provider=heroku --app=tdt4242-group-5-backend --api-key=$HEROKU_STAGING_API_KEY
only:
- master
node_modules
frontend/platforms
frontend/plugins
frontend/node_modules
\ No newline at end of file
{
"semi": true,
"trailingComma": "none",
"singleQuote": false,
"printWidth": 100,
"tabWidth": 4,
"useTabs": true,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"endOfLine": "auto"
}
{
"liveServer.settings.root": "frontend/www/"
}
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
asgiref = "==3.2.10"
astroid = "==2.4.2"
certifi = "==2020.6.20"
chardet = "==3.0.4"
colorama = "==0.4.3"
dj-database-url = "==0.5.0"
django-cleanup = "==5.0.0"
django-cors-headers = "==3.4.0"
djangorestframework = "==3.11.1"
djangorestframework-simplejwt = "==4.4.0"
gunicorn = "==20.0.4"
httpie = "==2.2.0"
idna = "==2.10"
isort = "==4.3.21"
lazy-object-proxy = "==1.4.3"
mccabe = "==0.6.1"
psycopg2-binary = "*"
pylint = "==2.5.3"
pylint-django = "==2.3.0"
pylint-plugin-utils = "==0.6"
pytz = "==2020.1"
requests = "==2.24.0"
rope = "==0.17.0"
six = "==1.15.0"
sqlparse = "==0.3.1"
toml = "==0.10.1"
urllib3 = "==1.25.10"
whitenoise = "==5.2.0"
wrapt = "==1.12.1"
Django = "==3.1"
Pygments = "==2.6.1"
PyJWT = "==1.7.1"
rest-framework-generic-relations = "==2.1.0"
[dev-packages]
[requires]
python_version = "3.8"
{
"_meta": {
"hash": {
"sha256": "49242bf996372e286f22a7f3c01dfc388784e93fe712c277d19a41cb54f637d3"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"asgiref": {
"hashes": [
"sha256:7e51911ee147dd685c3c8b805c0ad0cb58d360987b56953878f8c06d2d1c6f1a",
"sha256:9fc6fb5d39b8af147ba40765234fa822b39818b12cc80b35ad9b0cef3a476aed"
],
"index": "pypi",
"version": "==3.2.10"
},
"astroid": {
"hashes": [
"sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703",
"sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"
],
"index": "pypi",
"version": "==2.4.2"
},
"certifi": {
"hashes": [
"sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3",
"sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"
],
"index": "pypi",
"version": "==2020.6.20"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"index": "pypi",
"version": "==3.0.4"
},
"colorama": {
"hashes": [
"sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff",
"sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"
],
"index": "pypi",
"version": "==0.4.3"
},
"dj-database-url": {
"hashes": [
"sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163",
"sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9"
],
"index": "pypi",
"version": "==0.5.0"
},
"django": {
"hashes": [
"sha256:1a63f5bb6ff4d7c42f62a519edc2adbb37f9b78068a5a862beff858b68e3dc8b",
"sha256:2d390268a13c655c97e0e2ede9d117007996db692c1bb93eabebd4fb7ea7012b"
],
"index": "pypi",
"version": "==3.1"
},
"django-cleanup": {
"hashes": [
"sha256:84f0c0e0a74545adae4c944a76ccf8fb0c195dddccf3b7195c59267abb7763dd",
"sha256:de5948e74e00fc74d19bf15e062477b45090ba467587f45b2459eae8f97bc4f4"
],
"index": "pypi",
"version": "==5.0.0"
},
"django-cors-headers": {
"hashes": [
"sha256:5240062ef0b16668ce8a5f43324c388d65f5439e1a30e22c38684d5ddaff0d15",
"sha256:f5218f2f0bb1210563ff87687afbf10786e080d8494a248e705507ebd92d7153"
],
"index": "pypi",
"version": "==3.4.0"
},
"djangorestframework": {
"hashes": [
"sha256:6dd02d5a4bd2516fb93f80360673bf540c3b6641fec8766b1da2870a5aa00b32",
"sha256:8b1ac62c581dbc5799b03e535854b92fc4053ecfe74bad3f9c05782063d4196b"
],
"index": "pypi",
"version": "==3.11.1"
},
"djangorestframework-simplejwt": {
"hashes": [
"sha256:288ee78618d906f26abf6282b639b8f1806ce1d9a7578897a125cf79c609f259",
"sha256:c315be70aa12a5f5790c0ab9acd426c3a58eebea65a77d0893248c5144a5080c"
],
"index": "pypi",
"version": "==4.4.0"
},
"gunicorn": {
"hashes": [
"sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626",
"sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"
],
"index": "pypi",
"version": "==20.0.4"
},
"httpie": {
"hashes": [
"sha256:31ac28088ee6a0b6f3ba7a53379000c4d1910c1708c9ff768f84b111c14405a0",
"sha256:aab111d347a3059ba507aa9339c621e5cae6658cc96f365cd6a32ae0fb6ad8aa"
],
"index": "pypi",
"version": "==2.2.0"
},
"idna": {
"hashes": [
"sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
"sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
],
"index": "pypi",
"version": "==2.10"
},
"isort": {
"hashes": [
"sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1",
"sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"
],
"index": "pypi",
"version": "==4.3.21"
},
"lazy-object-proxy": {
"hashes": [
"sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d",
"sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449",
"sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08",
"sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a",
"sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50",
"sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd",
"sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239",
"sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb",
"sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea",
"sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e",
"sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156",
"sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142",
"sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442",
"sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62",
"sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db",
"sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531",
"sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383",
"sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a",
"sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357",
"sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4",
"sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"
],
"index": "pypi",
"version": "==1.4.3"
},
"mccabe": {
"hashes": [
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
],
"index": "pypi",
"version": "==0.6.1"
},
"psycopg2-binary": {
"hashes": [
"sha256:01310cf4cf26db9aea5158c217caa92d291f0500051a6469ac52166e1a16f5b7",
"sha256:083a55275f09a62b8ca4902dd11f4b33075b743cf0d360419e2051a8a5d5ff76",
"sha256:090f3348c0ab2cceb6dfbe6bf721ef61262ddf518cd6cc6ecc7d334996d64efa",
"sha256:0a29729145aaaf1ad8bafe663131890e2111f13416b60e460dae0a96af5905c9",
"sha256:0c9d5450c566c80c396b7402895c4369a410cab5a82707b11aee1e624da7d004",
"sha256:10bb90fb4d523a2aa67773d4ff2b833ec00857f5912bafcfd5f5414e45280fb1",
"sha256:12b11322ea00ad8db8c46f18b7dfc47ae215e4df55b46c67a94b4effbaec7094",
"sha256:152f09f57417b831418304c7f30d727dc83a12761627bb826951692cc6491e57",
"sha256:15803fa813ea05bef089fa78835118b5434204f3a17cb9f1e5dbfd0b9deea5af",
"sha256:15c4e4cfa45f5a60599d9cec5f46cd7b1b29d86a6390ec23e8eebaae84e64554",
"sha256:183a517a3a63503f70f808b58bfbf962f23d73b6dccddae5aa56152ef2bcb232",
"sha256:1f14c8b0942714eb3c74e1e71700cbbcb415acbc311c730370e70c578a44a25c",
"sha256:1f6b813106a3abdf7b03640d36e24669234120c72e91d5cbaeb87c5f7c36c65b",
"sha256:280b0bb5cbfe8039205c7981cceb006156a675362a00fe29b16fbc264e242834",
"sha256:2d872e3c9d5d075a2e104540965a1cf898b52274a5923936e5bfddb58c59c7c2",
"sha256:2f9ffd643bc7349eeb664eba8864d9e01f057880f510e4681ba40a6532f93c71",
"sha256:3303f8807f342641851578ee7ed1f3efc9802d00a6f83c101d21c608cb864460",
"sha256:35168209c9d51b145e459e05c31a9eaeffa9a6b0fd61689b48e07464ffd1a83e",
"sha256:3a79d622f5206d695d7824cbf609a4f5b88ea6d6dab5f7c147fc6d333a8787e4",
"sha256:404224e5fef3b193f892abdbf8961ce20e0b6642886cfe1fe1923f41aaa75c9d",
"sha256:46f0e0a6b5fa5851bbd9ab1bc805eef362d3a230fbdfbc209f4a236d0a7a990d",
"sha256:47133f3f872faf28c1e87d4357220e809dfd3fa7c64295a4a148bcd1e6e34ec9",
"sha256:526ea0378246d9b080148f2d6681229f4b5964543c170dd10bf4faaab6e0d27f",
"sha256:53293533fcbb94c202b7c800a12c873cfe24599656b341f56e71dd2b557be063",
"sha256:539b28661b71da7c0e428692438efbcd048ca21ea81af618d845e06ebfd29478",
"sha256:57804fc02ca3ce0dbfbef35c4b3a4a774da66d66ea20f4bda601294ad2ea6092",
"sha256:63638d875be8c2784cfc952c9ac34e2b50e43f9f0a0660b65e2a87d656b3116c",
"sha256:6472a178e291b59e7f16ab49ec8b4f3bdada0a879c68d3817ff0963e722a82ce",
"sha256:68641a34023d306be959101b345732360fc2ea4938982309b786f7be1b43a4a1",
"sha256:6e82d38390a03da28c7985b394ec3f56873174e2c88130e6966cb1c946508e65",
"sha256:761df5313dc15da1502b21453642d7599d26be88bff659382f8f9747c7ebea4e",
"sha256:7af0dd86ddb2f8af5da57a976d27cd2cd15510518d582b478fbb2292428710b4",
"sha256:7b1e9b80afca7b7a386ef087db614faebbf8839b7f4db5eb107d0f1a53225029",
"sha256:874a52ecab70af13e899f7847b3e074eeb16ebac5615665db33bce8a1009cf33",
"sha256:887dd9aac71765ac0d0bac1d0d4b4f2c99d5f5c1382d8b770404f0f3d0ce8a39",
"sha256:8b344adbb9a862de0c635f4f0425b7958bf5a4b927c8594e6e8d261775796d53",
"sha256:8fc53f9af09426a61db9ba357865c77f26076d48669f2e1bb24d85a22fb52307",
"sha256:91920527dea30175cc02a1099f331aa8c1ba39bf8b7762b7b56cbf54bc5cce42",
"sha256:93cd1967a18aa0edd4b95b1dfd554cf15af657cb606280996d393dadc88c3c35",
"sha256:99485cab9ba0fa9b84f1f9e1fef106f44a46ef6afdeec8885e0b88d0772b49e8",
"sha256:9d29409b625a143649d03d0fd7b57e4b92e0ecad9726ba682244b73be91d2fdb",
"sha256:a29b3ca4ec9defec6d42bf5feb36bb5817ba3c0230dd83b4edf4bf02684cd0ae",
"sha256:a9e1f75f96ea388fbcef36c70640c4efbe4650658f3d6a2967b4cc70e907352e",
"sha256:accfe7e982411da3178ec690baaceaad3c278652998b2c45828aaac66cd8285f",
"sha256:adf20d9a67e0b6393eac162eb81fb10bc9130a80540f4df7e7355c2dd4af9fba",
"sha256:af9813db73395fb1fc211bac696faea4ca9ef53f32dc0cfa27e4e7cf766dcf24",
"sha256:b1c8068513f5b158cf7e29c43a77eb34b407db29aca749d3eb9293ee0d3103ca",
"sha256:bda845b664bb6c91446ca9609fc69f7db6c334ec5e4adc87571c34e4f47b7ddb",
"sha256:c381bda330ddf2fccbafab789d83ebc6c53db126e4383e73794c74eedce855ef",
"sha256:c3ae8e75eb7160851e59adc77b3a19a976e50622e44fd4fd47b8b18208189d42",
"sha256:d1c1b569ecafe3a69380a94e6ae09a4789bbb23666f3d3a08d06bbd2451f5ef1",
"sha256:def68d7c21984b0f8218e8a15d514f714d96904265164f75f8d3a70f9c295667",
"sha256:dffc08ca91c9ac09008870c9eb77b00a46b3378719584059c034b8945e26b272",
"sha256:e3699852e22aa68c10de06524a3721ade969abf382da95884e6a10ff798f9281",
"sha256:e847774f8ffd5b398a75bc1c18fbb56564cda3d629fe68fd81971fece2d3c67e",
"sha256:ffb7a888a047696e7f8240d649b43fb3644f14f0ee229077e7f6b9f9081635bd"
],
"index": "pypi",
"version": "==2.9.3"
},
"pygments": {
"hashes": [
"sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44",
"sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324"
],
"index": "pypi",
"version": "==2.6.1"
},
"pyjwt": {
"hashes": [
"sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e",
"sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"
],
"index": "pypi",
"version": "==1.7.1"
},
"pylint": {
"hashes": [
"sha256:7dd78437f2d8d019717dbf287772d0b2dbdfd13fc016aa7faa08d67bccc46adc",
"sha256:d0ece7d223fe422088b0e8f13fa0a1e8eb745ebffcb8ed53d3e95394b6101a1c"
],
"index": "pypi",
"version": "==2.5.3"
},
"pylint-django": {
"hashes": [
"sha256:770e0c55fb054c6378e1e8bb3fe22c7032a2c38ba1d1f454206ee9c6591822d7",
"sha256:b8dcb6006ae9fa911810aba3bec047b9410b7d528f89d5aca2506b03c9235a49"
],
"index": "pypi",
"version": "==2.3.0"
},
"pylint-plugin-utils": {
"hashes": [
"sha256:2f30510e1c46edf268d3a195b2849bd98a1b9433229bb2ba63b8d776e1fc4d0a",
"sha256:57625dcca20140f43731311cd8fd879318bf45a8b0fd17020717a8781714a25a"
],
"index": "pypi",
"version": "==0.6"
},
"pytz": {
"hashes": [
"sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed",
"sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"
],
"index": "pypi",
"version": "==2020.1"
},
"requests": {
"hashes": [
"sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b",
"sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"
],
"index": "pypi",
"version": "==2.24.0"
},
"rest-framework-generic-relations": {
"hashes": [
"sha256:0b7479ba36e87282aae61eeeafd380bd01883ef17aa88eedf61f98cbd07fcbc9",
"sha256:b01da2eca2b91051973d38c8a66c2a1812bdc9f601c0a85f863b72caa9309d63"
],
"index": "pypi",
"version": "==2.1.0"
},
"rope": {
"hashes": [
"sha256:658ad6705f43dcf3d6df379da9486529cf30e02d9ea14c5682aa80eb33b649e1"
],
"index": "pypi",
"version": "==0.17.0"
},
"setuptools": {
"hashes": [
"sha256:6599055eeb23bfef457d5605d33a4d68804266e6cb430b0fb12417c5efeae36c",
"sha256:782ef48d58982ddb49920c11a0c5c9c0b02e7d7d1c2ad0aa44e1a1e133051c96"
],
"markers": "python_version >= '3.7'",
"version": "==60.10.0"
},
"six": {
"hashes": [
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
],
"index": "pypi",
"version": "==1.15.0"
},
"sqlparse": {
"hashes": [
"sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e",
"sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"
],
"index": "pypi",
"version": "==0.3.1"
},
"toml": {
"hashes": [
"sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f",
"sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"
],
"index": "pypi",
"version": "==0.10.1"
},
"urllib3": {
"hashes": [
"sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a",
"sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"
],
"index": "pypi",
"version": "==1.25.10"
},
"whitenoise": {
"hashes": [
"sha256:05ce0be39ad85740a78750c86a93485c40f08ad8c62a6006de0233765996e5c7",
"sha256:05d00198c777028d72d8b0bbd234db605ef6d60e9410125124002518a48e515d"
],
"index": "pypi",
"version": "==5.2.0"
},
"wrapt": {
"hashes": [
"sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"
],
"index": "pypi",
"version": "==1.12.1"
}
},
"develop": {}
}
......@@ -28,6 +28,7 @@ Hosts the application on http://localhost:9090 with default settings
You might have to run Docker with administrator privileges to get it to run properly:
#### Windows:
Either open the terminal as administrator (Windows key -> Search "cmd" -> "Run as administrator")
or
......@@ -35,19 +36,19 @@ or
$ runas /user/Administrator "docker-compose up --build"
#### Unix/OSX:
$ sudo docker-compose up --build
$ sudo docker-compose up --build
## Technology
- **deployment** Docker
- **web** Nginx
- **database** Postgre SQL
- **backend** Django 3 with Django REST framework
- **application**
- **browser** - HTML5/CSS/JS, Bootstrap v5 (no jQuery dependency)
- **mobile** Apache Cordova (uses same website)
- **authentication** JWT
- **deployment** Docker
- **web** Nginx
- **database** Postgre SQL
- **backend** Django 3 with Django REST framework
- **application**
- **browser** - HTML5/CSS/JS, Bootstrap v5 (no jQuery dependency)
- **mobile** Apache Cordova (uses same website)
- **authentication** JWT
## Code and structure
......@@ -55,36 +56,34 @@ $ sudo docker-compose up --build
requirements.txt - Python requirements
package.json - Some node.js requirements, this is needed for cordova
- **secfit/** django project folder containing the project modules
- **<application_name>/** - generic structure of a django application
- **admins.py** - file contaning definitions to connect models to the django admin panel
- **urls.py** - contains mapping between urls and views
- **models.py** - contains data models
- **permissions.py** - contains custom permissions that govern access
- **serializers.py** - contains serializer definitions for sending data between backend and frontend
- **parsers.py** - contains custom parsers for parsing the body of HTTP requests
- **tests/** - contains tests for the module. [View Testing in Django](https://docs.djangoproject.com/en/2.1/topics/testing/) for more.
- **views.py** - Controller in MVC. Methods for rendering and accepting user data
- **forms.py** - definitions of forms. Used to render html forms and verify user input
- **settings.py** - Contains important settings at the application and/or project level
- **Procfile** - Procfile for backend heroku deployment
- **media/** - directory for file uploads (need to commit it for heroku)
- **comments/** - application handling user comments and reactions
- **secfit/** - The projects main module containing project-level settings.
- **users/** - application handling users and requests
- **workouts/** - application handling exercises and workouts
- **manage.py** - entry point for running the project.
- **seed.json** - contains seed data for the project to get it up and running quickly (coming soon)
- **secfit/** django project folder containing the project modules
- **<application_name>/** - generic structure of a django application
- **admins.py** - file contaning definitions to connect models to the django admin panel
- **urls.py** - contains mapping between urls and views
- **models.py** - contains data models
- **permissions.py** - contains custom permissions that govern access
- **serializers.py** - contains serializer definitions for sending data between backend and frontend
- **parsers.py** - contains custom parsers for parsing the body of HTTP requests
- **tests/** - contains tests for the module. [View Testing in Django](https://docs.djangoproject.com/en/2.1/topics/testing/) for more.
- **views.py** - Controller in MVC. Methods for rendering and accepting user data
- **forms.py** - definitions of forms. Used to render html forms and verify user input
- **settings.py** - Contains important settings at the application and/or project level
- **Procfile** - Procfile for backend heroku deployment
- **media/** - directory for file uploads (need to commit it for heroku)
- **comments/** - application handling user comments and reactions
- **secfit/** - The projects main module containing project-level settings.
- **users/** - application handling users and requests
- **workouts/** - application handling exercises and workouts
- **manage.py** - entry point for running the project.
- **seed.json** - contains seed data for the project to get it up and running quickly (coming soon)
## Local setup
It's recommended to have a look at: https://www.djangoproject.com/start/
Just as important is the Django REST guide: https://www.django-rest-framework.org/
Create a virtualenv https://docs.python-guide.org/dev/virtualenvs/
### Django
Installation with examples for Ubuntu. Windows and OSX is mostly the same
......@@ -92,19 +91,17 @@ Installation with examples for Ubuntu. Windows and OSX is mostly the same
Fork the project and clone it to your machine.
#### Setup and activation of virtualenv (env that prevents python packages from being installed globaly on the machine)
Naviagate into the project folder, and create your own virtual environment
Naviagate into the project folder, and create your own virtual environment
#### Install python requirements
`pip install -r requirements.txt`
#### Migrate database
`python manage.py migrate`
#### Create superuser
Create a local admin user by entering the following command:
......@@ -113,35 +110,36 @@ Create a local admin user by entering the following command:
Only username and password is required
#### Start the app
`python manage.py runserver`
#### Add initial data
You can add initial data either by going to the url the app is running on locally and adding `/admin` to the url.
Add some categories and you should be all set.
Or by entering
Or by entering
`python manage.py loaddata seed.json`
### Cordova
Cordova CLI guide: https://cordova.apache.org/docs/en/latest/guide/cli/
If you want to run this as a mobile application
- Navigate to the frontend directory
- For android, do `cordova run android`
- For ios, do `cordova run ios`
- For browser, do `cordova run browser`
- Navigate to the frontend directory
- For android, do `cordova run android`
- For ios, do `cordova run ios`
- For browser, do `cordova run browser`
It's possible you will need to add the platforms you want to run and build.
The following documentation can be used to run the application in an Android emulator: \
https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html
## Continuous integration
WARNING: Do not perform penetration testing on Heroku applications
Continuous integration will build the code pushed to master and push it to your heroku app so you get a live version of your latest code by just pushing your code to GitLab.
......@@ -149,39 +147,40 @@ Continuous integration will build the code pushed to master and push it to your
1. Make sure you have the right python version (3.8.10) and have all other requirements installed.
2. Create a heroku account and an app for both the frontend and the backend. (Choose Europe as your region)
3. Select buildpacks for the two apps. The backend uses Python while the frontend uses nodejs.
* Heroku > Settings > Buildpacks > Add buildpack
* Both applications need the buildpack https://github.com/heroku/heroku-buildpack-multi-procfile.git too.
- Heroku > Settings > Buildpacks > Add buildpack
- Both applications need the buildpack https://github.com/heroku/heroku-buildpack-multi-procfile.git too.
4. Set the two projects in the .gitlab-cs.yml file by replacing `<Your-herokuproject-name>` with the name of the Heroku apps you created. Commit and push your change.
`- dpl --provider=heroku --app=<Your-herokuproject-name> --api-key=$HEROKU_STAGING_API_KEY`
`- dpl --provider=heroku --app=<Your-herokuproject-name> --api-key=$HEROKU_STAGING_API_KEY`
5. Set/Add varibles at GitLab
* GitLab > settings > ci > Variables > Expand
* Key = `HEROKU_STAGING_API_KEY`
* Value = Your API Key from Heroku (Heroku > Account Settings > API Key > Reveal)
* Type = Variable, Environment scope = All(default)
* Protect should not be enabled and Mask should be enabled
- GitLab > settings > ci > Variables > Expand
- Key = `HEROKU_STAGING_API_KEY`
- Value = Your API Key from Heroku (Heroku > Account Settings > API Key > Reveal)
- Type = Variable, Environment scope = All(default)
- Protect should not be enabled and Mask should be enabled
6. Add heroku database for the backend
* Heroku > Resources > Add ons > search for `postgres` > add "Heroku Postgres"
* Choose the free plan.
- Heroku > Resources > Add ons > search for `postgres` > add "Heroku Postgres"
- Choose the free plan.
7. Set variables for the backend on Heroku. Heroku > Settings > Config vars > Reveal vars
* `DATABASE_URL` = Should be set by default. If not here is where you can find it: Heroku > Resources > postgress > settings > view credentials > URI
* `IS_HEROKU` = `IS_HEROKU`
* `PROCFILE` = `Procfile`
- `DATABASE_URL` = Should be set by default. If not here is where you can find it: Heroku > Resources > postgress > settings > view credentials > URI
- `IS_HEROKU` = `IS_HEROKU`
- `PROCFILE` = `Procfile`
8. Set variables for the frontend on heroku. Heroku > Settings > Config vars > Reveal vars. Insert the URL for your backend app and the path to your Procfile. (Example: `https://secfit-group01-v22-backend.herokuapp.com`)
* `BACKEND_HOST` = `https://<SECFIT_BACKEND>.herokuapp.com`
* `PROCFILE` = `frontend/Procfile`
9. Push the repository to both of the heroku applications
* Follow the guides on https://devcenter.heroku.com/articles/git#for-an-existing-heroku-app
* Make sure you install the heroku CLI https://devcenter.heroku.com/articles/heroku-cli
* Make sure you log in to the heroku CLI ($ heroku login)
* Make sure you create a remote for the frontend and backend apps (Example: heroku git:remote -a secfit-group01-v22-frontend)
* Push your code to both apps (Your URLs can also be found on the settings page on your Heroku apps)
* Example: $ git push https://git.heroku.com/secfit-group01-v22-frontend.git master
* Make sure you use `master` and not `main` as your target branch
- `BACKEND_HOST` = `https://<SECFIT_BACKEND>.herokuapp.com`
- `PROCFILE` = `frontend/Procfile`
9. Push the repository to both of the heroku applications
- Follow the guides on https://devcenter.heroku.com/articles/git#for-an-existing-heroku-app
- Make sure you install the heroku CLI https://devcenter.heroku.com/articles/heroku-cli
- Make sure you log in to the heroku CLI ($ heroku login)
- Make sure you create a remote for the frontend and backend apps (Example: heroku git:remote -a secfit-group01-v22-frontend)
- Push your code to both apps (Your URLs can also be found on the settings page on your Heroku apps)
- Example: $ git push https://git.heroku.com/secfit-group01-v22-frontend.git master
- Make sure you use `master` and not `main` as your target branch
10. On GitLab go to CI / CD in the repository menu and select `Run Pipeline` if it has not already started. When both stages complete the app should be available on heroku. The log should state that the app was deployed.
11. Setup the applications database.
* Log in to the Heroku CLI by entering `heroku login` if you have not already done this. This opens a webbrowser and you accept the login request.
* Migrate database by entering
`heroku run python backend/secfit/manage.py migrate -a <heroku-app-name>`. `Heroku run` will run the folowing command on your heroku instance. Remember to replace `<heroku-app-name>` with your backend app name
* and create an admin account for the backend by running
`heroku run python backend/secfit/manage.py createsuperuser -a <heroku-app-name>`.
* seed database `heroku run python backend/secfit/manage.py loaddata backend/secfit/seed.json -a <heroku-app-name>`
- Log in to the Heroku CLI by entering `heroku login` if you have not already done this. This opens a webbrowser and you accept the login request.
- Migrate database by entering
`heroku run python backend/secfit/manage.py migrate -a <heroku-app-name>`. `Heroku run` will run the folowing command on your heroku instance. Remember to replace `<heroku-app-name>` with your backend app name
- and create an admin account for the backend by running
`heroku run python backend/secfit/manage.py createsuperuser -a <heroku-app-name>`.
- seed database `heroku run python backend/secfit/manage.py loaddata backend/secfit/seed.json -a <heroku-app-name>`
File added
# Generated by Django 3.1 on 2022-02-28 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('meals', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='meal',
name='visibility',
field=models.CharField(choices=[('PU', 'Public'), ('CO', 'Coach'), ('PR', 'Private')], default='CO', max_length=2),
),
]
......@@ -37,6 +37,7 @@ class Meal(models.Model):
calories: Total amount of calories in the meal
is_veg: Whether the meal was vegetarian or not
owner: User that logged the meal
visibility: The level of visibility of the meal, default as coach.
"""
name = models.CharField(max_length=100)
......@@ -48,6 +49,20 @@ class Meal(models.Model):
get_user_model(), on_delete=models.CASCADE, related_name="meals"
)
# Visibility levels
PUBLIC = "PU" # Visible to all authenticated users
COACH = "CO" # Visible only to owner and their coach
PRIVATE = "PR" # Visible only to owner
VISIBILITY_CHOICES = [
(PUBLIC, "Public"),
(COACH, "Coach"),
(PRIVATE, "Private"),
] # Choices for visibility level
visibility = models.CharField(
max_length=2, choices=VISIBILITY_CHOICES, default=COACH
)
class Meta:
ordering = ["-date"]
......
......@@ -28,8 +28,25 @@ class IsOwnerOfMeal(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
return obj.meal.owner == request.user
class IsReadOnly(permissions.BasePermission):
"""Checks whether the HTTP request verb is only for retrieving data (GET, HEAD, OPTIONS)"""
def has_object_permission(self, request, view, obj):
return request.method in permissions.SAFE_METHODS
class IsCoachAndVisibleToCoach(permissions.BasePermission):
"""Checks whether the requesting user is the existing object's owner's coach
and whether the object (meal) has a visibility of Public or Coach.
"""
def has_object_permission(self, request, view, obj):
return obj.owner.coach == request.user
class IsPublic(permissions.BasePermission):
"""Checks whether the object (meal) has visibility of Public."""
def has_object_permission(self, request, view, obj):
return obj.visibility == "PU"
......@@ -55,6 +55,7 @@ class MealSerializer(serializers.HyperlinkedModelSerializer):
"owner",
"owner_username",
"files",
"visibility"
]
extra_kwargs = {"owner": {"read_only": True}}
......@@ -101,6 +102,7 @@ class MealSerializer(serializers.HyperlinkedModelSerializer):
instance.notes = validated_data.get("notes", instance.notes)
instance.is_veg = validated_data.get("is_veg", instance.is_veg)
instance.calories = validated_data.get("calories", instance.calories)
instance.visibility = validated_data.get("visibility", instance.visibility)
instance.save()
# Handle MealFiles
......
......@@ -16,6 +16,7 @@ urlpatterns = format_suffix_patterns(
views.MealDetail.as_view(),
name="meal-detail",
),
path("api/users/<str:username>/meals/",views.UserMealList.as_view(), name="user-meals"),
path(
"api/meal-files/",
views.MealFileList.as_view(),
......
......@@ -11,8 +11,11 @@ from rest_framework.response import Response
from rest_framework.reverse import reverse
from django.db.models import Q
from rest_framework import filters
from notifications.models import Notification
from meals.parsers import MultipartJsonParser
from meals.permissions import (
IsCoachAndVisibleToCoach,
IsPublic,
IsOwner,
IsOwnerOfMeal,
IsReadOnly,
......@@ -28,6 +31,7 @@ import json
from collections import namedtuple
import base64, pickle
from django.core.signing import Signer
from users.models import User
@api_view(["GET"])
......@@ -69,14 +73,63 @@ class MealList(
return self.create(request, *args, **kwargs)
def perform_create(self, serializer):
serializer.save(owner=self.request.user)
meal = serializer.save(owner=self.request.user)
# Send notification to all subscribers of owner when meal is created and either:
# - is visible to public
# - is visible to coach and the coach is subscribing
if meal.visibility == "PU":
for subscriber in self.request.user.subscribers.all():
Notification.objects.create(content_object=meal, receiver=subscriber)
elif meal.visibility == "CO" and self.request.user.coach in self.request.user.subscribers.all():
Notification.objects.create(content_object=meal, receiver=self.request.user.coach)
def get_queryset(self):
qs = Meal.objects.none()
if self.request.user:
qs = Meal.objects.filter(Q(owner=self.request.user)).distinct()
# A meal should be visible to the requesting user if any of the following hold:
# - The meal has public visibility
# - The owner of the meal is the requesting user
# - The meal has coach visibility and the requesting user is the owner's coach
qs = Meal.objects.filter(
Q(visibility="PU")
| (Q(visibility="CO") & Q(owner__coach=self.request.user))
| Q(owner=self.request.user)
).distinct()
return qs
class UserMealList(
mixins.ListModelMixin, mixins.CreateModelMixin, generics.GenericAPIView
):
"""Class defining the web response for displaying a list of meals for a spesific user
HTTP methods: GET
"""
serializer_class = MealSerializer
permission_classes = [
permissions.IsAuthenticated
] # User must be authenticated to view workouts
parser_classes = [
MultipartJsonParser,
JSONParser,
]
def get(self, request, *args, **kwargs):
return self.list(request, *args, **kwargs)
def get_queryset(self):
return Meal.objects.filter(
Q(owner=User.objects.get(username=self.kwargs["username"])) & (
Q(visibility="PU")
| (Q(visibility="CO") & Q(owner__coach=self.request.user)))
| Q(owner=self.request.user)
).distinct()
class MealDetail(
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
......@@ -92,7 +145,7 @@ class MealDetail(
serializer_class = MealSerializer
permission_classes = [
permissions.IsAuthenticated
& IsOwner
& (IsOwner | (IsReadOnly & (IsCoachAndVisibleToCoach | IsPublic)))
]
parser_classes = [MultipartJsonParser, JSONParser]
......
from django.contrib import admin
from .models import Notification
# Register your models here.
admin.site.register(Notification)
\ No newline at end of file
from django.apps import AppConfig
class NotificationsConfig(AppConfig):
name = 'notifications'
# Generated by Django 3.1 on 2022-02-27 11:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Notification',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(auto_now_add=True)),
('object_id', models.PositiveIntegerField()),
('read', models.BooleanField(default=False)),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
('receiver', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notifications', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-timestamp'],
},
),
]
# Generated by Django 3.1 on 2022-02-28 10:30
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('notifications', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='notification',
name='timestamp',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]