{"id":18256938,"url":"https://github.com/mediacomem/sqlexplorer-frontend","last_synced_at":"2025-04-08T22:29:01.754Z","repository":{"id":39787253,"uuid":"120761997","full_name":"MediaComem/sqlexplorer-frontend","owner":"MediaComem","description":"The front end application for the SQL Explorer app.","archived":false,"fork":false,"pushed_at":"2022-05-25T23:10:33.000Z","size":644,"stargazers_count":0,"open_issues_count":6,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-14T17:43:27.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MediaComem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-08T13:01:06.000Z","updated_at":"2019-06-12T14:29:29.000Z","dependencies_parsed_at":"2022-09-17T10:52:00.613Z","dependency_job_id":null,"html_url":"https://github.com/MediaComem/sqlexplorer-frontend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsqlexplorer-frontend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsqlexplorer-frontend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsqlexplorer-frontend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fsqlexplorer-frontend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MediaComem","download_url":"https://codeload.github.com/MediaComem/sqlexplorer-frontend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247938596,"owners_count":21021555,"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":[],"created_at":"2024-11-05T10:24:14.540Z","updated_at":"2025-04-08T22:29:01.733Z","avatar_url":"https://github.com/MediaComem.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Explorer frontend\n\nThis is the front-end application for the [SQL Explorer website](https://sqlexplorer.heig-vd.ch).\n\nIt's an AngularJS application that displays a website structured in three sections :\n\n# Site structure\n\nThe site is composed of three \"sections\":\n* The \"public section\" is the section on which one would land when accessing the website. It's a section where one can executes `SELECT` requests on a specific database (see [Public section](#public-section))\n* The \"admin section\" is the section where administrators can somewhat manage the content, asssignments and questions available on the application (see [Admin section](#admin-section))\n* The \"assignment section\" is a section that can **only be accessed through a Moodle activity**. This is where one can answer specific SQL related questions and get a grade in return (see [Assignment section](#assignment-section))\n\n# Sections\n\n## Public section\n\nTo change database, change the last part of the URL to the name of the database, in lower case.\n\nFor example, change the default URL `https://sqlexplorer.heig-vd.ch/#/production` to `https://sqlexplorer.heig-vd.ch/#/librairie` to got to the `Librairie` database.\n\nThe list of available databases is accessible through the [Admin section](#admin-section) or by connecting directly to the SQL Server instance.\n\n## Admin section\n\nTo access the admin section, simply go to this URL : `https://sqlexplorer.heig-vd.ch/#/admin` _(please, never name an assignment database \"Admin\" as you'll have some trouble accessing it)_\n\nYou'll see a list of available databases along with some links that represents the sub-section of this admin section.\n\n\u003e Accesing any of the database of the sub-sections requires some credentials, that one can find in the MEI KeePass, under the `App admin user (production)` name\n\nClicking on...\n* any database will display the list of related questions.\n* the **Questions** link displays all available questions in the app, and allows one to create new assignments (see [Create new assignments](#create-new-assignments))\n* the **Assignments** link displays nothing until you select an existing assignment in the dropdown list. Then it shows the questions of this assignment.\n\n## Assignment section\n\nTo access this section, you must create a new SQL Explorer activity on Cyberlearn pointing to one of the existing assignments.\n\nWhen accessing this assignment, the UI will be very similar to that of the public section, except you'll have specific questions and a grade.\n\n## Moodle configuration\n\nThe SQL Explorer activity configuration can be found on Cyberlearn. You'll need admin privileges to access it.\n\nGo to **Administration du site \u003e Plugins \u003e Modules d'activité \u003e Outil externe \u003e Gérer les outils**, and select the **SQL Explorer** tool to see the config.\n\n## Create new assignments\n\nTo create new assignments, go to `https://sqlexplorer.heig-vd.ch/#/admin/questions` and click on the **New Assignment** button. You'll need to fill in:\n* The name of the assignment\n* The year of the assignment (usually the school year, like `2018-2019` but it's up to you ; any string will do... )\n* The name of the course to which this assignment is related\n\nWhen it's created, you'll find it's name in the **Assignment** dropdown list. Select it.\n\nYou can then filter the displayed questions using any of the SQL keywords or the **database** dropdown list.\n\nSimply click the **add to assignment** link next to any question to add it to the currently selected assignment.\n\nNothing needs to be done when you've added all the questions needed to the assignment. Simply head over to Cyberlearn and create a new SQL Explorer activity, then select the content and you should find your new assignment.\n\n## Add new assignment database\n\nTo add a new assignment, be sure to have those requried files:\n\n* A `.png` file that represents your database's model (**only use lower case for the file and extension name!**)\n* A `.sql` script file that creates the database and fill it with data\n\nYou'll need to `scp` the `.png` file in the correct folder on the server\n\n```shell\n# from the directory that contains the png file\n$\u003e scp databasename.png sqlexplorer@193.134.216.114:/var/www/sqlexplorer/schema_pics\n```\n\u003e You'll be prompted for the `sqlexplorer` user's password. You'll find it on the MEI KeePass\n\nConnect to the remote SQL Server directly using, for example [Azure Data Studio][azure]. The connection config is as follows:\n\n* **Connection type**: Microsoft SQL Server\n* **Server**: 193.134.216.114\n* **Authentication type**: SQL Login\n* **User name**: Use the `Sqlexplorer app admin` entry in the MEI KeePass\n* **Password**: Use the `Sqlexplorer app admin` entry in the MEI KeePass\n* **Database**: Keep `\u003cDefault\u003e`\n* **Server group**: Do as you please (this is only for Azure Data Studio internal structure)\n* **Name (optional)**: It's indeed optional... do as you please\n\nWhen the connection is created, open the `.sql` file on the software and click the **Run** button, then select the connection to the server.\n\nWhen the database is created, you can then execute the following script:\n\n```sql\nUSE \u003cDatabaseName\u003e;\nCREATE USER [sqlexplorer] FOR LOGIN [sqlexplorer];\nALTER ROLE [db_datareader] ADD MEMBER [sqlexplorer];\nGO\n\nALTER DATABASE \u003cDatabaseName\u003e SET AUTO_CLOSE OFF\nGO\n```\n\u003e Replace `\u003cDatabaseName\u003e` by the name of the database **as it appears in the creation script**\n\nTo check that the database is created and the model image is visible, simply go the `https://sqlexplorer.heig-vd.ch/#/admin` and search for your database in the list of available database\n\n## Add new questions\n\nTo add new questions, you'll need to connect to the PostgreSQL database directly and execute `INSERT` queries, one for each of the questions to add.\n\n\u003e This connection will be done via SSH, so be sure to add your private key as an authorized key on the server where the database is located.\n\nHere the config used for the SSH connection (this is a config for JetBrains DataGrip, but it should be adequate for any other software or CLI tool):\n\n* Proxy host: 193.134.216.114\n* Proxy port: 22\n* Proxy user: Use the username of the `Compte droit sudo` entry in the MEI KeePass\n* Auth type: Key Pair (Open SSH or PuTTY)\n* Private key file: the path to your local private key file\n\nThe connection on the server should be done using these params:\n\n* Host: localhost\n* Port: 5432\n* User: Use the username of the `Sqlexplorer app admin` entry in the MEI KeePass\n* Password: Use the password of the `Sqlexplorer app admin` entry in the MEI KeePass\n* Database: sqlexplorer\n\nOnce connected, you'll need to execute the following request to add a new question:\n\n```sql\nINSERT INTO questions (db_schema, text, sql, modified) VALUES ([The name of the database, in lowercase], [The description of the question], [The correct SQL query that answer the question], NOW());\n```\n\n[azure]: https://docs.microsoft.com/en-us/sql/azure-data-studio/download?view=sql-server-2017\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fsqlexplorer-frontend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediacomem%2Fsqlexplorer-frontend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fsqlexplorer-frontend/lists"}