Skip to content

Commit

Permalink
feat(form-system-backend): Add functionality to create and edit custo…
Browse files Browse the repository at this point in the history
…m lists (#15352)

* form builder 'init'

* Added functionality for relevant parties

* redirect to the correct url when creating a new form

* removed secret from comment

* chore: nx format:write update dirty files

* Property number component

* Fixed the header

* Reverted to next 13.3.0

* Deleted the e2e project, updated to project to adhere to strict typescript, removed all console.logs and removed all code that was commented out

* chore: nx format:write update dirty files

* Started implementing zod validation

* chore: nx format:write update dirty files

* Generated a nestjs client from our openapi schema

* Generated a client and created a domain client for graphql

* Update Form, Group, Input, and Step DTOs

* Refactor input settings in FormsService and Input model

* Update API and authentication configurations

* Added form-system client and module to the app/api and added a codegen + script to generate graphql schemas

* Remove form-system module and add formSystemNavigation to masterNavigation

* Refactor form-system API code and formBuilder into portals/admin

* Fixng typing erros in form system graphql domain

* Added another Object type and a bunch of inputTypes in order for codegen to work

* Update import statements for LanguageTypeInput

* Update form system module and related files

* Update FormSystemClient.config and Forms component

* Saving progress

* Working version. Current issue: inputsettings are not being saved due to graphql not handling type discriminators

* took out the formsysteminputsettings and replaced it with a graphqlTypeJson

* spring cleaning and creating dependencies within the form

* removed form-builder app

* chore: charts update dirty files

* chore: nx format:write update dirty files

* form-system backend initial commit

* initial configuration

* adjust for PR

* fix lint warnings

* add models and modules

* helstu módel, services og controllerar

* make lint satisfied

* Add functionality to create and edit custom lists

* application part start

* change step to section and group to page

* tiny lint things

* change naming of page to screen

* changed naming of input to field

* fix lint warnings

* change naming of input to field

* work on application part

* change tablenames to singular

* changed naming of testimony to certification

* fixing apiproperty configurations

* changed naming of urlName to slug

* introduce lodash pick

* refactor vegna PR

* add openapi.yaml build

* Refactor project setup

* Add class validation for CreateFormDto

* add class-validation

* use predefined types for cases in switch

* Fix build

* Fix lint

* Update tags

* Remove empty test files

* Skip tests until implemented

* Add advania as codeowner for new service

* add infra definition

* add the service to uber-charts

* chore: charts update dirty files

* update grantNamespaces

* chore: charts update dirty files

* added seed instruction to DLS

* chore: charts update dirty files

---------

Co-authored-by: Hyo-Sam Nandkisore <[email protected]>
Co-authored-by: andes-it <[email protected]>
Co-authored-by: Sævar Már Atlason <[email protected]>
Co-authored-by: Bæring Gunnar Steinþórsson <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
6 people authored Aug 9, 2024
1 parent 61ba7e9 commit f75cac3
Show file tree
Hide file tree
Showing 164 changed files with 8,319 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ codemagic.yaml
/libs/island-ui/ @island-is/island-ui

/apps/consultation-portal/ @island-is/advania
/apps/services/form-system/ @island-is/advania
/libs/clients/consultation-portal/ @island-is/advania
/libs/api/domains/consultation-portal/ @island-is/advania

Expand Down
18 changes: 18 additions & 0 deletions apps/services/form-system/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions apps/services/form-system/.sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const path = require('path')

module.exports = {
config: path.resolve('sequelize.config.js'),
'seeders-path': path.resolve('seeders'),
'migrations-path': path.resolve('migrations'),
}
17 changes: 17 additions & 0 deletions apps/services/form-system/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.3'

services:
db_reference_backend:
image: public.ecr.aws/docker/library/postgres:15.3-alpine
container_name: form-system
networks:
- local
environment:
- POSTGRES_DB=dev_db
- POSTGRES_USER=dev_db
- POSTGRES_PASSWORD=dev_db
ports:
- 5432:5432

networks:
local:
62 changes: 62 additions & 0 deletions apps/services/form-system/esbuild.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"platform": "node",
"external": [
"fsevents",
"color-convert",
"color-string",
"@nestjs/microservices",
"class-transformer",
"cache-manager",
"@nestjs/websockets/socket-module",
"class-validator",
"class-transformer",
"@nestjs/microservices/microservices-module",
"apollo-server-fastify",
"@elastic/elasticsearch",
"fastify-swagger",
"@nestjs/mongoose",
"@nestjs/typeorm",
"dd-trace",
"express",
"http-errors",
"graphql",
"pg",
"winston",
"util-deprecate",
"source-map-resolve",
"atob",
"logform",
"pg-native",
"form-data",
"swagger-ui-dist",
"configcat-node",
"mock-aws-s3",
"nock",
"@protobufjs/aspromise",
"@protobufjs/base64",
"@protobufjs/codegen",
"@protobufjs/eventemitter",
"@protobufjs/fetch",
"@protobufjs/float",
"@protobufjs/inquire",
"@protobufjs/path",
"@protobufjs/pool",
"@protobufjs/utf8",
"pseudomap",
"p-cancelable",
"@sindresorhus/is",
"@szmarczak/http-timer",
"cacheable-request",
"decompress-response",
"duplexer3",
"get-stream",
"lowercase-keys",
"mimic-response",
"to-readable-stream",
"url-parse-lax",
"safer-buffer",
"ioredis",
"@mikro-orm/core"
],
"keepNames": true
}
19 changes: 19 additions & 0 deletions apps/services/form-system/infra/form-system.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { service, ServiceBuilder } from '../../../../infra/src/dsl/dsl'

export const serviceSetup = (): ServiceBuilder<'services-form-system'> =>
service('services-form-system')
.image('services-form-system')
.namespace('services-form-system')
.env({
IDENTITY_SERVER_ISSUER_URL: {
dev: 'https://identity-server.dev01.devland.is',
staging: 'https://identity-server.staging01.devland.is',
prod: 'https://innskra.island.is',
},
})
.liveness('/liveness')
.readiness('/readiness')
.db()
.seed()
.migrations()
.grantNamespaces('islandis')
11 changes: 11 additions & 0 deletions apps/services/form-system/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'services-form-system',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '<rootDir>/coverage/',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use strict'

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.createTable(
'organization',
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false,
defaultValue: Sequelize.UUIDV4,
},
name: {
type: Sequelize.JSON,
allowNull: false,
},
created: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
modified: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
national_id: {
type: Sequelize.STRING,
allowNull: false,
},
},
{ transaction: t },
),
)
},

async down(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.dropTable('organization', { transaction: t }),
)
},
}
80 changes: 80 additions & 0 deletions apps/services/form-system/migrations/20240605120322-create-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
'use strict'

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.createTable(
'form',
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false,
defaultValue: Sequelize.UUIDV4,
},
name: {
type: Sequelize.JSON,
allowNull: false,
},
slug: {
type: Sequelize.STRING,
allowNull: false,
unique: true,
},
created: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
modified: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
invalidation_date: {
type: Sequelize.DATE,
allowNull: true,
},
is_translated: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
application_days_to_remove: {
type: Sequelize.INTEGER,
allowNull: false,
defaultValue: 60,
},
derived_from: {
type: Sequelize.INTEGER,
allowNull: false,
},
stop_progress_on_validating_screen: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: true,
},
completed_message: {
type: Sequelize.JSON,
allowNull: true,
},
organization_id: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: 'organization',
key: 'id',
},
},
},
{ transaction: t },
),
)
},

async down(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.dropTable('form', { transaction: t }),
)
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
'use strict'

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.createTable(
'section',
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false,
defaultValue: Sequelize.UUIDV4,
},
name: {
type: Sequelize.JSON,
allowNull: false,
},
created: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
modified: {
type: 'TIMESTAMP WITH TIME ZONE',
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
allowNull: false,
},
section_type: {
type: Sequelize.DataTypes.ENUM(
'premises',
'parties',
'input',
'payment',
),
allowNull: false,
defaultValue: 'input',
},
display_order: {
type: Sequelize.INTEGER,
allowNull: false,
},
waiting_text: {
type: Sequelize.JSON,
allowNull: true,
},
is_hidden: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
is_completed: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false,
},
form_id: {
type: Sequelize.UUID,
onDelete: 'CASCADE',
allowNull: false,
references: {
model: 'form',
key: 'id',
},
},
},
{ transaction: t },
),
)
},

async down(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((t) =>
queryInterface.dropTable('section', { transaction: t }),
)
},
}
Loading

0 comments on commit f75cac3

Please sign in to comment.