{"id":23819845,"url":"https://github.com/kth/kurs-pm-api","last_synced_at":"2025-06-18T12:43:30.300Z","repository":{"id":37493504,"uuid":"199613028","full_name":"KTH/kurs-pm-api","owner":"KTH","description":"Håller tjänster för att spara ner och hämta information om kurs-pm som PDF för en specifik kursomgång. (PDF finns i azure storage)","archived":false,"fork":false,"pushed_at":"2024-06-18T13:26:56.000Z","size":2209,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-06-18T16:09:56.989Z","etag":null,"topics":["kurs-pm-admin-web","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KTH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-30T08:50:09.000Z","updated_at":"2024-06-18T16:10:04.192Z","dependencies_parsed_at":"2023-12-15T09:45:03.262Z","dependency_job_id":"88148f34-03a6-43b7-9d34-2687e28be7ef","html_url":"https://github.com/KTH/kurs-pm-api","commit_stats":null,"previous_names":[],"tags_count":2119,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkurs-pm-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/kurs-pm-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232163088,"owners_count":18481581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kurs-pm-admin-web","rest-api"],"created_at":"2025-01-02T07:16:04.455Z","updated_at":"2025-01-02T07:16:05.708Z","avatar_url":"https://github.com/KTH.png","language":"JavaScript","readme":"# Welcome to Kurs-pm-api 👋\n\n![Version](https://img.shields.io/badge/version-2.0.0-blue.svg?cacheSeconds=2592000)\n![Prerequisite](https://img.shields.io/badge/node-18-blue.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n\n## Api to Upload alternative course memo as PDF\n\nThis API is made within course information projekt(kip) to **support only one admin micro service** to administrate uploading of memo as PDF in `kurs-pm-admin-web`.\n\nThis api is used only by `kurs-pm-admin-web` to upload memo files in PDF format to a common blobstorage and saves information about file in database.\nImportant to know, **this api is not used by public pages**, instead use `kurs-pm-data-api`.\n\nSame blobstorage and database is used by another web admin service `kurs-pm-data-admin-web` which is used to create/edit web based memos (not uploaded pdf)\n\nAs it was mentioned above, it is an alternative project to `kurs-pm-data-api` (preferably to use `kurs-pm-data-api` and `kurs-pm-data-admin-web`)\n\nThe two projects are [kurs-pm-admin-web][web], a web server with express, and [kurs-pm-api][api], a RESTful API.\nThe `kurs-pm-admin-web` project use OpenID Connect and/or CAS as a mechanism for authorisation and authentication.\n\n#### Where can I find all connected projects which depends on this API?\n\n- [https://github.com/KTH/kurs-pm-admin-web.git][web]\n\n#### Where can I find all connected projects which logically connected with this API?\n\n- [https://github.com/KTH/kursinfo-admin-web.git][web]\n\nThe service `kursinfo-admin-web`[Administrate about course] is used as an entrance to this service `kurs-pm-admin-web`.\n\nThis API is independent and will not break other projects but it is important remember it is logically connected to the bigger picture of course information.\nIt uses the same data models as `kurs-pm-data-api` but use different functions. It is separated in case `kurs-pm-admin-web` will be deprecated in favor of `kurs-pm-data-admin-web`.\nTherefore it is connected only to admin part to save data and send it to the same database which is used by `kurs-pm-data-api` and `kurs-pm-api`.\n\n#### How do I use this API project for a project of my own?\n\n1. Create a new repository on Gita or Github.\n2. Clone the newly created repository locally by using:\n\n   ```bash\n   git clone git@github.com:KTH/kurs-pm-api.git\n   npm run start-dev\n   or\n   npm run start\n   ```\n\n   Make sure that your .git/config file is pointing to the new NEW_REPOSITORY_NAME\n\n3. Navigate to the cloned project directory\n\n### How to configure the applications\n\nSecrets during local development are stored in a gitignored `.env` file (`env.in` can be used as template for your `.env` file). More details about environment variable setup and secrets can be found in [confluence](https://confluence.sys.kth.se/confluence/x/OYKBDQ).\n\n## Prepara Database in Azure\n\n1. Create database `kursinfo` and manually set Throughput: 400 (Shared). Name of database will be used in a connection string.\n2. In this database create a collection `coursememos` where a shard key is `/courseCode`.\n3. Change a connection string by adding name of database (`kursinfo`) after port slush `[port]/` and as a search query after `?` as `authSorce=kursinfo`:\n\n`mongodb://kurs-pm-data-api-stage-mongodb-kthse:[password]==@kurs-pm-data-api-stage-mongodb-kthse.documents.azure.com:[port]`~~/?ssl=true~~`/kursinfo?ssl=true\u0026authSource=kursinfo`\n\nMore information can be found in Confluence: [Om kursen: Databas och API, connection string](https://confluence.sys.kth.se/confluence/x/a4_KC)\n\n### How API data look like in configure the applications\n\nLook at data definitions and paths in `swagger.json` and in [http://localhost:3003/api/kurs-pm/swagger][localhost swagger].\nHere is one example\n\n```\n.\n\"ExistingData\": {\n  \"properties\": {\n    \"_id\": {\n      \"type\": \"string\",\n      \"description\": \"Unique identifier representing some specific data\"\n    },\n    \"memoName\": {\n      \"type\": \"string\",\n      \"description\": \"Kurstillfällen ska visas med kortnamn i första handalternativt kurstillfällets termin och kurstillfälleskod om kortnamn saknas. Därefter ska kurstillfällets startdatum och undervisningsspråk visas inom parentes.Formatet för visning av kurstillfälle är således:[kurstillfälle.kortnamn] alt. [termin-kurstillfälleskod] (Startdatum [kurstillfälle.startdatum], [kurstillfälle.undervisningsspråk])\"\n    },\n    \"courseCode\": {\n      \"type\": \"string\",\n      \"description\": \"Course code for which it is valid\"\n    },\n    \"commentChange\": {\n      \"type\": \"string\",\n      \"description\": \"Comments about changes which were introduced after publishing, f.e., why have teacher uploaded a new version, what changed there\"\n    },\n    \"isPublished\": {\n      \"type\": \"string\",\n      \"description\": \"If document is published or in draft version\"\n    },\n    \"publishedDate\": {\n      \"type\": \"string\",\n      \"description\": \"When document were published (first)?? time\"\n    },\n    \"pdfPMDate\": {\n      \"type\": \"string\",\n      \"description\": \"Time when pdf were stored in storage (f.e., Azure blobstorage)\"\n    },\n    \"changedDate\": {\n      \"type\": \"string\",\n      \"description\": \"When data were changed??\"\n    },\n    \"changedBy\": {\n      \"type\": \"string\",\n      \"description\": \"Unique KTH id of user who uploaded or changed this document data, f.e., u1iooii,\"\n    },\n    \"semester\": {\n      \"type\": \"string\",\n      \"description\": \"Course start term year (spring(VT)-1, autumn(HT)-2) , f.e. 20182 or 20181 (termin)\"\n    },\n    \"courseMemoFileName\": {\n      \"type\": \"string\",\n      \"description\": \"Uploaded courseMemo file\"\n    }\n  },\n  \"ugKeys\": {\n    \"type\": \"array\",\n    \"description\": \"UG Keys for access to edit course memos???\"\n  },\n  \"changedAfterPublishedDate\": {\n    \"type\": \"array\",\n    \"description\": \"Date for changes made after published???\"\n  },\n\n},\n```\n\nVesion handles:\n\n```json\n{\n  \"previousFileList\": {\n    \"type\": \"array\",\n    \"items\": \"object\",\n    \"description\": \"Array for object with previous memo files and its upload date\",\n    \"properties\": {\n      \"courseMemoFileName\": {\n        \"type\": \"string\",\n        \"description\": \"File name of a previous course memo\"\n      },\n      \"lastChangeDate\": {\n        \"type\": \"string\",\n        \"description\": \"Published date of a previous course memo\"\n      },\n      \"version\": {\n        \"type\": \"string\",\n        \"description\": \"Version number of course memo\"\n      }\n    }\n  }\n}\n```\n\n#### What is `swagger-ui-dist`?\n\nThe `swagger-ui-dist` package is simply used to provide a basic UI for\ntesting the API. It is not directly required in the code, which\nmeans running checks like `npm-check` will claim it is unused.\nIt cannot be stressed enough, **do not remove this package**!\n\n#### What url to use locally?\n\n```\nlocalhost:3001/api/kurs-pm/_about\nlocalhost:3001/api/kurs-pm/_monitor\nlocalhost:3001/api/kurs-pm/swagger\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkurs-pm-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Fkurs-pm-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkurs-pm-api/lists"}