Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type List_GET =
Header "Authorization" String
:> Header "x-user-count" String
:> Header "x-knowledge-model-package-count" String
:> Header "x-qtn-count" String
:> Header "x-project-count" String
:> Header "x-knowledge-model-editor-count" String
:> Header "x-doc-count" String
:> Header "x-tml-count" String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ list_GET
-> Maybe String
-> Maybe Int
-> BaseContextM (Headers '[Header "x-trace-uuid" String] [KnowledgeModelPackageSimpleDTO])
list_GET mTokenHeader xUserCountHeaderValue xPkgCountHeaderValue xQtnCountHeaderValue xKnowledgeModelEditorCountHeaderValue xDocCountHeaderValue xTmlCountHeaderValue mOrganizationId mKmId mMetamodelVersion =
list_GET mTokenHeader xUserCountHeaderValue xPkgCountHeaderValue xProjectCountHeaderValue xKnowledgeModelEditorCountHeaderValue xDocCountHeaderValue xTmlCountHeaderValue mOrganizationId mKmId mMetamodelVersion =
getMaybeAuthServiceExecutor mTokenHeader $ \runInMaybeAuthService ->
runInMaybeAuthService Transactional $
addTraceUuidHeader =<< do
Expand All @@ -34,7 +34,7 @@ list_GET mTokenHeader xUserCountHeaderValue xPkgCountHeaderValue xQtnCountHeader
catMaybes
[ (,) xUserCountHeaderName <$> xUserCountHeaderValue
, (,) xKnowledgeModelPackageCountHeaderName <$> xPkgCountHeaderValue
, (,) xQtnCountHeaderName <$> xQtnCountHeaderValue
, (,) xProjectCountHeaderName <$> xProjectCountHeaderValue
, (,) xKnowledgeModelEditorCountHeaderName <$> xKnowledgeModelEditorCountHeaderValue
, (,) xDocCountHeaderName <$> xDocCountHeaderValue
, (,) xTmlCountHeaderName <$> xTmlCountHeaderValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ instance ToRow AuditEntry where
, toField instanceStatistics.userCount
, toField instanceStatistics.pkgCount
, toField instanceStatistics.kmEditorCount
, toField instanceStatistics.qtnCount
, toField instanceStatistics.prjCount
, toField instanceStatistics.tmlCount
, toField instanceStatistics.docCount
, toField (Nothing :: Maybe String)
Expand Down Expand Up @@ -77,7 +77,7 @@ instance FromRow AuditEntry where
userCount <- field
pkgCount <- field
kmEditorCount <- field
qtnCount <- field
prjCount <- field
tmlCount <- field
docCount <- field
let instanceStatistics = InstanceStatistics {..}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ createTables = do
\ user_count int, \
\ knowledge_model_package_count int, \
\ knowledge_model_editor_count int, \
\ questionnaire_count int, \
\ project_count int, \
\ document_template_count int, \
\ document_count int, \
\ knowledge_model_package_id varchar, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ iStat =
InstanceStatistics
{ userCount = 10
, pkgCount = 20
, qtnCount = 30
, prjCount = 30
, kmEditorCount = 40
, docCount = 50
, tmlCount = 60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import qualified Registry.Database.Migration.Production.Migration_0012_tenant.Mi
import qualified Registry.Database.Migration.Production.Migration_0013_jsonb.Migration as M_0013
import qualified Registry.Database.Migration.Production.Migration_0014_documentTemplateMetamodel.Migration as M_0014
import qualified Registry.Database.Migration.Production.Migration_0015_knowledgeModelRefactor.Migration as M_0015
import qualified Registry.Database.Migration.Production.Migration_0016_project.Migration as M_0016

migrationDefinitions :: [MigrationDefinition]
migrationDefinitions =
Expand All @@ -35,4 +36,5 @@ migrationDefinitions =
, M_0013.definition
, M_0014.definition
, M_0015.definition
, M_0016.definition
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Registry.Database.Migration.Production.Migration_0016_project.Migration (
definition,
) where

import Control.Monad.Logger
import Control.Monad.Reader (liftIO)
import Data.Pool (Pool, withResource)
import Database.PostgreSQL.Migration.Entity
import Database.PostgreSQL.Simple

definition = (meta, migrate)

meta = MigrationMeta {mmNumber = 16, mmName = "Project Refactor", mmDescription = "Refactor project schema and related tables"}

migrate :: Pool Connection -> LoggingT IO (Maybe Error)
migrate dbPool = do
let sql = "ALTER TABLE audit RENAME COLUMN questionnaire_count TO project_count;"
let action conn = execute_ conn sql
liftIO $ withResource dbPool action
return Nothing
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GHC.Generics
data InstanceStatistics = InstanceStatistics
{ userCount :: Int
, pkgCount :: Int
, qtnCount :: Int
, prjCount :: Int
, kmEditorCount :: Int
, docCount :: Int
, tmlCount :: Int
Expand Down
2 changes: 1 addition & 1 deletion registry-server/src/Registry/Service/Audit/AuditService.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ getInstanceStaticsFromHeaders headers =
in InstanceStatistics
{ userCount = get xUserCountHeaderName
, pkgCount = get xKnowledgeModelPackageCountHeaderName
, qtnCount = get xQtnCountHeaderName
, prjCount = get xProjectCountHeaderName
, kmEditorCount = get xKnowledgeModelEditorCountHeaderName
, docCount = get xDocCountHeaderName
, tmlCount = get xTmlCountHeaderName
Expand Down
2 changes: 1 addition & 1 deletion registry-server/test/Registry/Specs/API/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ reqStatisticsHeader :: [Header]
reqStatisticsHeader =
[ (CI.mk . BS.pack $ xUserCountHeaderName, BS.pack . show $ iStat.userCount)
, (CI.mk . BS.pack $ xKnowledgeModelPackageCountHeaderName, BS.pack . show $ iStat.pkgCount)
, (CI.mk . BS.pack $ xQtnCountHeaderName, BS.pack . show $ iStat.qtnCount)
, (CI.mk . BS.pack $ xProjectCountHeaderName, BS.pack . show $ iStat.prjCount)
, (CI.mk . BS.pack $ xKnowledgeModelEditorCountHeaderName, BS.pack . show $ iStat.kmEditorCount)
, (CI.mk . BS.pack $ xDocCountHeaderName, BS.pack . show $ iStat.docCount)
, (CI.mk . BS.pack $ xTmlCountHeaderName, BS.pack . show $ iStat.tmlCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ detail_GET appContext =
-- ----------------------------------------------------
reqMethod = methodGet

reqUrl = "/document-templates/global:questionnaire-report:1.0.0"
reqUrl = "/document-templates/global:project-report:1.0.0"

reqHeaders = [reqCtHeader]

Expand Down
4 changes: 2 additions & 2 deletions shared-common/src/Shared/Common/Constant/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ xUserCountHeaderName = "x-user-count"
xKnowledgeModelPackageCountHeaderName :: String
xKnowledgeModelPackageCountHeaderName = "x-knowledge-model-package-count"

xQtnCountHeaderName :: String
xQtnCountHeaderName = "x-qtn-count"
xProjectCountHeaderName :: String
xProjectCountHeaderName = "x-project-count"

xKnowledgeModelEditorCountHeaderName :: String
xKnowledgeModelEditorCountHeaderName = "x-knowledge-model-editor-count"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ createHttpClientManager serverConfig =

modifyRequest :: Bool -> Request -> IO Request
modifyRequest logHttpClient request = do
let updatedRequest =
let originalHeaders = requestHeaders request
-- Filter out "User-Agent" headers (case-insensitive) and (re-)add our explicit "User-Agent" header, to ensure there's only one User-Agent header.
-- Note: Reason for using case-insensitive search for header key(s) is because HTTP spec. states that header keys are case-insensitive.
headersWithoutUA = filter (\(headerName, _) -> headerName /= CI.mk (BS.pack "User-Agent")) originalHeaders
updatedRequest =
request
{ path = BS.pack . replace "//" "/" . BS.unpack . path $ request
, requestHeaders = ("User-Agent", "wizard-http-client") : requestHeaders request
, requestHeaders = ("User-Agent", "wizard-http-client") : headersWithoutUA
}
logRequest logHttpClient updatedRequest
return updatedRequest
Expand Down
4 changes: 2 additions & 2 deletions shared-common/src/Shared/Common/Util/Aeson.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jsonSpecialFields "gId" = "id"
jsonSpecialFields "iId" = "id"
jsonSpecialFields "lId" = "id"
jsonSpecialFields "pId" = "id"
jsonSpecialFields "qaId" = "id"
jsonSpecialFields "qiId" = "id"
jsonSpecialFields "paId" = "id"
jsonSpecialFields "piId" = "id"
jsonSpecialFields "sId" = "id"
jsonSpecialFields "tId" = "id"
jsonSpecialFields "aData" = "data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ html =
{# VARIABLES #}
{# ------------------------------------------------------------------------------------ #}
{%- set km = ctx.knowledgeModel -%}
{%- set replies = ctx.questionnaireReplies -%}
{%- set repliesMap = ctx.questionnaireRepliesMap -%}
{%- set replies = ctx.projectReplies -%}
{%- set repliesMap = ctx.projectRepliesMap -%}
{%- set report = ctx.report -%}
{%- set metricDefinitions = ctx.metrics -%}
{%- set levelDefinitions = ctx.levels -%}
Expand Down Expand Up @@ -380,7 +380,7 @@ html =
<h1>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 204 153"><path d="M151,113.37,137.24,89.08l-24.67-7.25,19-2.76L113.81,47.7,95.94,37.89l17.18,2.85,37.53,5.7L94.59,1.33c-2.76-2.67-6.88-1.47-8.32,2.44l-14.4,55,20,3.36L69.71,67,57.32,114.31l36.85,5.2-41.56,6.63L.66,152.1s34.15-1.54,45.76-3.16c44-6.14,76.34-6.76,120.36-13.54,7.71-1.19,37.56-20.62,37.56-20.62Z" style="fill:#333"/></svg>
<div class="headline">
<span class="questionnaire-name">{{ctx.questionnaireName}}</span><br>
<span class="project-name">{{ctx.projectName}}</span><br>
<span class="km-name">{{km.name}}</span>
</div>
</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import Shared.KnowledgeModel.Database.Migration.Development.KnowledgeModel.Data.
wizardDocumentTemplate :: DocumentTemplate
wizardDocumentTemplate =
DocumentTemplate
{ tId = "global:questionnaire-report:1.0.0"
, name = "Questionnaire Report"
{ tId = "global:project-report:1.0.0"
, name = "Project Report"
, organizationId = "global"
, templateId = "questionnaire-report"
, templateId = "project-report"
, version = "1.0.0"
, phase = ReleasedDocumentTemplatePhase
, metamodelVersion = documentTemplateMetamodelVersion
, description = "Exported questions and answers from a questionnaire"
, description = "Exported questions and answers from a project"
, readme = "# Default DocumentTemplate"
, license = "Apache-2.0"
, allowedPackages = [kmPackagePatternAll]
Expand All @@ -34,7 +34,7 @@ wizardDocumentTemplateDeprecated = wizardDocumentTemplate {phase = DeprecatedDoc
wizardDocumentTemplateDraft :: DocumentTemplate
wizardDocumentTemplateDraft =
wizardDocumentTemplate
{ tId = "global:questionnaire-report:2.0.0"
{ tId = "global:project-report:2.0.0"
, name = "DRAFT: " ++ wizardDocumentTemplate.name
, version = "2.0.0"
, phase = DraftDocumentTemplatePhase
Expand All @@ -45,7 +45,7 @@ wizardDocumentTemplateDraft =
wizardDocumentTemplateNlDraft :: DocumentTemplate
wizardDocumentTemplateNlDraft =
wizardDocumentTemplate
{ tId = "org.nl.amsterdam:questionnaire-report:3.0.0"
{ tId = "org.nl.amsterdam:project-report:3.0.0"
, name = "New Document Template"
, organizationId = "org.nl.amsterdam"
, version = "3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data WizardUsageDTO = WizardUsageDTO
, knowledgeModelEditors :: UsageEntryDTO
, documentTemplates :: UsageEntryDTO
, documentTemplateDrafts :: UsageEntryDTO
, questionnaires :: UsageEntryDTO
, projects :: UsageEntryDTO
, documents :: UsageEntryDTO
, locales :: UsageEntryDTO
, storage :: UsageEntryDTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tenantLimitBundleChange =
, knowledgeModelEditors = -1000
, documentTemplates = -1000
, documentTemplateDrafts = -1000
, questionnaires = -1000
, projects = -1000
, documents = -1000
, locales = -1000
, storage = -1000 * 5 * 1000 * 1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defaultUsage =
, knowledgeModelEditors = defaultUsageKnowledgeModelEditors
, documentTemplates = defaultUsageDocumentTemplates
, documentTemplateDrafts = defaultUsageDocumentTemplateDrafts
, questionnaires = defaultUsageQuestionnaires
, projects = defaultUsageProjects
, documents = defaultUsageDocuments
, locales = defaultUsageLocales
, storage = defaultUsageStorage
Expand Down Expand Up @@ -42,8 +42,8 @@ defaultUsageDocumentTemplates = UsageEntryDTO {current = 0, max = -1000}
defaultUsageDocumentTemplateDrafts :: UsageEntryDTO
defaultUsageDocumentTemplateDrafts = UsageEntryDTO {current = 0, max = -1000}

defaultUsageQuestionnaires :: UsageEntryDTO
defaultUsageQuestionnaires = UsageEntryDTO {current = 0, max = -1000}
defaultUsageProjects :: UsageEntryDTO
defaultUsageProjects = UsageEntryDTO {current = 0, max = -1000}

defaultUsageDocuments :: UsageEntryDTO
defaultUsageDocuments = UsageEntryDTO {current = 0, max = -1000}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module WizardLib.Public.Model.PersistentCommand.Project.CreateProjectCommand where

import Data.Aeson
import GHC.Generics

import Shared.Common.Util.Aeson

data CreateProjectCommand = CreateProjectCommand
{ name :: String
, emails :: [String]
, knowledgeModelPackageId :: String
, documentTemplateId :: Maybe String
}
deriving (Show, Eq, Generic)

instance FromJSON CreateProjectCommand where
parseJSON = genericParseJSON jsonOptions

instance ToJSON CreateProjectCommand where
toJSON = genericToJSON jsonOptions

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data TenantLimitBundleChange = TenantLimitBundleChange
, knowledgeModelEditors :: Int
, documentTemplates :: Int
, documentTemplateDrafts :: Int
, questionnaires :: Int
, projects :: Int
, documents :: Int
, locales :: Int
, storage :: Int64
Expand Down
Loading