Skip to content

uk-gov-mirror/SkillsFundingAgency.das-qna-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Apprenticeships Service

Question and Answer API

Licensed under the MIT license

crest QnA API
Info A Web API service which allows question sets to be organised and presented and their answers collected by exposing HTTP REST end points.
Build Build Status
Web https://localhost:5555/swagger/index.html
crest QnA API Client
Info A .Net Core client library for QnA API HTTP REST end points
Build NuGet Badge
crest QnA API Types
Info Common types to interact with the QnA Api
Build NuGet Badge
crest QnA API Views
Info Asp.Net Core Views using GOV UK Design System
Build NuGet Badge

See Support Site for EFSA developer details.

Developer Setup

Requirements

Alternatives (caveat emptor)

Setup

  • Clone this repository
  • Open Visual Studio as an administrator
Publish Database
  • Build the solution SFA.DAS.QnA.sln
  • Either use Visual Studio's Publish Database tool to publish the database project SFA.DAS.QnA.Database to name {{database name}} on {{local instance name}}
  • To include the latest question sets when publishing a database to your local SQL Server, you need to ensure that ProjectPath variable contains the full path in the format {{drive}}:\{{project-folders}}\das-qna-api\src\SFA.DAS.QnA.Database\
    • eg. C:\Source\Repos\SFA\das-qna-api\src\SFA.DAS.QnA.Database\

      Note: The required trailing backslash on the path in the example above.

or

  • Create a database manually named {{database name}} on {{local instance name}} and run each of the .sql scripts in the SFA.DAS.QnA.Database project.
Config
  • Get the das-qna-api configuration json file from das-employer-config; which is a non-public repository.
  • Create a Configuration table in your (Development) local Azure Storage account.
  • Add a row to the Configuration table with fields: PartitionKey: LOCAL, RowKey: SFA.DAS.QnA.Api_1.0, Data: {{The contents of the local config json file}}.
  • Update Configuration SFA.DAS.QnA.API_1.0, Data { "SqlConnectionstring":"Server={{local instance name}};Initial Catalog={{database name}};Trusted_Connection=True;" }
Run the solution

JSON configuration was created to work with dotnet run.

  • Navigate to src/SFA.DAS.QnA.API/
  • run dotnet restore
  • run dotnet run

or

  • Set SFA.DAS.QnA.API as the startup project
  • Running the solution will launch the API in your browser

To run a local copy you may also require

To create a JSON structure required to author updates and create new question sets:

To view how the question sets will be presented when integrated into a client application using GOV UK Design System:

Important Concepts

SFA.DAS.QnA.Application

Contains all of the application logic to handle requests

  • All requests are handled via MediatR

  • Requests are either:

    • Queries, which will perform Read action on data
    • Commands, which perform Create / Update / Delete action on data
  • Validators

    • A library of validators that may be used to validate Question input
    • ValidatorFactory will load the validators for each Question in the Page
    • Each validator should implement IValidator
    • AnswerValidator will execute each validator and return any validation errors

SFA.DAS.QnA.Configuration

Enables functionality to store and read configuration from Microsoft Azure storage

  • AuthenticationConfig

    • JWT authentication
  • FileStorageConfig

    • Information relating to storage of files
  • QnAConfig

    • Connection string for the QnA Database

SFA.DAS.QnA.Database

Database project containing setup in order to the create the QnA Database

  • projects

    • A subfolder should be created per Project
  • projects/{subfolder}/project.json

    • Contains information on how to setup the Workflow information
  • projects/{subfolder}/ApplicationDataSchema.json

    • Contains JSON schema to validate ApplicationData
  • projects/{subfolder}/sections

    • Holds QnAData for each WorkflowSection

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 90.8%
  • HTML 6.1%
  • TSQL 3.1%