Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 2024-04-02 #83

Merged
merged 17 commits into from
Apr 2, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# App updates VeiligStallen

## VeiligStallen 2024-04-02

**Algemeen**

- Nieuwe "Stalling aanmaken" in app header, voor ingelogde gebruikers

**Stallingen-beheer**

- Meld een nieuwe stalling aan als gastgebruiker
- Bij aanmelden stalling als gast: Verberg Capaciteit, Abonnementen en Beheerder
- Na opslaan voorgestelde stalling: Toon dat deze stalling 'doorgestuurd' is aan gemeente, en mogelijk later online komt

- Keur een aangemelde stalling goed als ingelogde gebruiker
- Knop: zet automatisch een marker op de kaart, op basis van adres
- Knop: vind automatisch adresgegevens op basis van de kaart-marker
- In bewerkmodus: geef de kaart 'vrij' voordat je de kaart-marker kunt verplaatsen
- Krijg validatie-meldingen voor stallingsvelden in bewerkdialoog (bijv: postcode)
- Zie notificatie na opslaan van een stalling

- Sla op wanneer de stalling is aangemaakt, en wanneer voor het laatst gewijzigd

**Stallingen-kaart**

- Op desktop, open direct stalling bij klik op kaart-marker

**Stallingen-filters**

- Nieuw "Aangemelde stallingen" filter, dat alleen gesuggereerde stallingen toont

## VeiligStallen 2024-03-03

**Algemeen**
Expand Down
2 changes: 1 addition & 1 deletion github/setup-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ gh variable set PROD_AZUREAPPSERVICE_PUBLISHPROFILE_VEILIGSTALLEN < ./github/pro
gh variable set ACC_AZUREAPPSERVICE_PUBLISHPROFILE_VEILIGSTALLEN < ./github/acceptance.PublishSettings

#enable the ci/cd action
gh workflow enable azure-webapps-node.yml
#gh workflow enable azure-webapps-node.yml

gh variable list
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"docker-run": "docker run -p 3000:3000 nextjs-docker"
},
"dependencies": {
"@auth/prisma-adapter": "^1.5.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@fontsource/roboto": "^4.5.8",
Expand All @@ -43,16 +44,18 @@
"next-auth": "^4.23.1",
"next-pwa": "^5.6.0",
"next-redux-wrapper": "^8.1.0",
"nodemailer": "^6.9.12",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.8.0",
"react-redux": "^8.0.5",
"superjson": "1.12.2",
"zod": "^3.21.4"
},
"devDependencies": {
"@prisma-korea/prisma-generator-proto": "^2.3.2",
"@prisma/client": "^5.1.1",
"@prisma/client": "^5.11.0",
"@types/bcrypt": "^5.0.0",
"@types/eslint": "^8.21.3",
"@types/formidable": "^3.4.3",
Expand All @@ -70,7 +73,7 @@
"postcss": "^8.4.21",
"prettier": "^2.8.6",
"prettier-plugin-tailwindcss": "^0.2.5",
"prisma": "^5.9.1",
"prisma": "^5.11.0",
"tailwindcss": "^3.2.7",
"typescript": "^5.0.2"
},
Expand Down
45 changes: 45 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2025,3 +2025,48 @@ enum accounts_account_type {
// sync
// reservation
// }

model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?

user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@unique([provider, providerAccountId])
}

model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime

@@unique([identifier, token])
}
2 changes: 1 addition & 1 deletion public/sw.js

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions scripts/create-test-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
const fs = require('fs');
const bcrypt = require('bcrypt');

const c_root_admin = 1; // Super Admin
const c_intern_admin = 2; // Admin (intern)
const c_intern_editor = 3; // Redacteur (intern)
const c_extern_admin = 4; // Admin (gemeente)
const c_extern_editor = 5; // Redacteur (gemeente)
const c_exploitant = 6; // Exploitant
const c_beheerder = 7; // Beheerder
// const c_exploitant_data_analyst: number = 8; // Exploitant data analyst -> disabled
const c_intern_data_analyst = 9;
// const c_extern_data_analyst: number = 10; // Extern data analyst -> disabled

const saltRounds = 13; // 13 salt rounds used in the original code

const stallingenIDs_utrecht = [
'E197BE1D-B9CC-9B59-D88D7A356D6FEEE8',
'E197C7FD-C31E-050A-EAB81894CEB8C946',
'E197C889-9EB9-5F9B-AEA4F4D7B993E795',
'E197CD25-9F4F-A2D5-26007A22650A4DC0',
'E197D9DC-C0B9-D9B2-9737C96AED1E68B0',
'E197DD9B-C7B6-C306-07C6F96E7F42A79B',
'E197EB66-A859-3EDA-D243C3789EEAE4F0',
'E198D753-B00C-0F41-9A8C0F275D822E6D',
'E199038B-DF30-10EB-93C7A52E7AA26808',
'E1991A95-08EF-F11D-FF946CE1AA0578FB',
'E199235E-A49E-734E-67A5836FA2358C14',
'E1994219-9047-F340-067A1D64587BC21D',
'E1994396-D16A-35F2-2D710CBCEC414338',
]

// +++++++++++++++++++++++++++++++++++++++++++
// Fill these fields

const username = "";
const email = "";
const password = "";
const roleID = c_root_admin;

// +++++++++++++++++++++++++++++++++++++++++++
function generateCustomId() {
// Function to generate a random hex string of a given length
const randomHex = (length) => {
let result = '';
const characters = '0123456789ABCDEF';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}

// Generate segments of the custom ID
const part1 = randomHex(8);
const part2 = randomHex(4);
const part3 = randomHex(4);
const part4 = randomHex(16);

// Combine segments into the custom ID format
return `${part1}-${part2}-${part3}-${part4}`;
}

const hashedPassword = bcrypt.hashSync(password, saltRounds);
// const newUserUUID = generateCustomId();
const newUserUUID = "D4351342-685D-D17A-B3617EEBBF39451C";


const sqluser = `INSERT INTO 'security_users' (
UserID,
Locale,
RoleID,
GroupID,
SiteID,
ParentID,
UserName,
EncryptedPassword,
EncryptedPassword2,
DisplayName,
LastLogin,
SendMailToMailAddress,
Theme,
Status) VALUES (
'${newUserUUID}',
'Dutch (Standard)',
${roleID},
'intern',
NULL,
'',
'${email}',
'${hashedPassword}',
'',
'${username}',
'2021-04-06 22:58:13',
NULL,
'default',
'1'
);`;

const sql = [];
sql.push(sqluser);

stallingenIDs_utrecht.forEach((stallingID, idx) => {
const sqlstalling = `INSERT INTO security_users_sites (ID,UserID,SiteID,IsContact) VALUES (${1000000+idx},'${newUserUUID}','${stallingID}','0');`
sql.push(sqlstalling);
});

fs.writeFileSync('create-test-user.sql', sql.join('\n'));
// console.log(sql);
2 changes: 1 addition & 1 deletion src/backend/handlers/crud-route-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const CrudRouteHandler = async <T>(

if ((request.method as HttpMethod) === "DELETE") {
const deleteResponse = await service.delete(id);
return response.status(20).json(deleteResponse);
return response.status(200).json(deleteResponse);
}

return response.status(405).send("Method not allowed");
Expand Down
12 changes: 4 additions & 8 deletions src/components/AppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// @ts-nocheck
import React, {useEffect, useState} from "react";
// import { useDispatch, useSelector } from "react-redux";
// import { useRouter } from "next/navigation";
// import { usePathname } from 'next/navigation';
// import Link from 'next/link'

import React from "react";
import AppHeaderDesktop from "~/components/AppHeaderDesktop";
import AppHeaderMobile from "~/components/AppHeaderMobile";

function AppHeader({
onStallingAanmelden
}: {
onStallingAanmelden?: () => void
}) {

return (
Expand All @@ -21,7 +17,7 @@ function AppHeader({
sm:flex
`}
>
<AppHeaderDesktop />
<AppHeaderDesktop onStallingAanmelden={onStallingAanmelden} />
</div>

<div
Expand Down
Loading
Loading