Skip to content

Commit d3eb0b6

Browse files
authored
Merge pull request #61 from vbetsch/develop
Sprint 3 - Implement UI for display, search, create and delete vaults
2 parents d6ae875 + 55d9629 commit d3eb0b6

File tree

29 files changed

+421
-101
lines changed

29 files changed

+421
-101
lines changed

.idea/dictionaries/project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules/
22
/dist/
3+
/.github/release_template.md
34
README.md

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"semi": true,
33
"singleQuote": true,
44
"tabWidth": 2,
5-
"trailingComma": "es5"
5+
"trailingComma": "es5",
6+
"arrowParens": "avoid"
67
}

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ package-lock.json:
88
node_modules: package-lock.json
99
npm clean-install
1010

11+
# Variables
12+
MIGRATION_NAME ?=
13+
1114
# Commands
1215
up: docker-compose.yml
1316
docker-compose up -d
@@ -35,13 +38,20 @@ coverage: node_modules
3538
npm run test:cov
3639

3740
migrate: up
38-
npx prisma migrate dev --name init
41+
@if [ -z "$(MIGRATION_NAME)" ]; then \
42+
echo "Error: MIGRATION_NAME is required"; \
43+
exit 1; \
44+
fi
45+
npm run prisma:migrate "$(MIGRATION_NAME)"
46+
47+
reset_db: up
48+
npm run prisma:reset
3949

4050
clean:
4151
rm -rf .next node_modules package-lock.json
4252
npm install
4353

44-
.PHONY: up down dev build lint format tests coverage migrate clean
54+
.PHONY: up down dev build lint format tests coverage migrate reset_db clean
4555

4656
# Aliases
4757
run: up dev

eslint.config.mjs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {dirname} from 'path';
2-
import {fileURLToPath} from 'url';
3-
import {FlatCompat} from '@eslint/eslintrc';
1+
import { dirname } from 'path';
2+
import { fileURLToPath } from 'url';
3+
import { FlatCompat } from '@eslint/eslintrc';
44
import js from '@eslint/js';
55
import tseslint from 'typescript-eslint';
66
import eslintPluginPrettier from 'eslint-plugin-prettier';
@@ -50,26 +50,28 @@ export default tseslint.config(
5050
message: 'Do not use `as any`, types must be explicit and safe.',
5151
},
5252
{
53-
selector: "JSXOpeningElement[name.type='JSXIdentifier'][name.name=/^[a-z]/]",
53+
selector:
54+
"JSXOpeningElement[name.type='JSXIdentifier'][name.name=/^[a-z]/]",
5455
message:
5556
'Do not use native HTML elements: use an MUI component (PascalCase) instead.',
5657
},
5758
],
5859

5960
/* Code structure and clarity */
6061
// 'max-params': ['warn', 1],
62+
6163
'default-case': 'warn',
6264
'import/no-unresolved': 'error',
6365
'no-inline-comments': 'warn',
6466
'no-undefined': 'warn',
6567
'no-var': 'error',
66-
'prefer-const': ['error', {destructuring: 'all'}],
68+
'prefer-const': ['error', { destructuring: 'all' }],
6769
'require-await': 'error',
6870
'require-object-destructuring': 'off',
69-
71+
'arrow-parens': ['error', 'as-needed'],
7072
/* Formatting */
71-
'max-len': ['warn', {code: 300, ignoreUrls: true}],
72-
'prettier/prettier': ['warn', {semi: true}],
73+
'max-len': ['warn', { code: 300, ignoreUrls: true }],
74+
'prettier/prettier': ['warn', { semi: true }],
7375
semi: ['error', 'always'],
7476

7577
/* Naming conventions */
@@ -120,29 +122,29 @@ export default tseslint.config(
120122
],
121123
'@typescript-eslint/explicit-function-return-type': [
122124
'error',
123-
{allowExpressions: false},
125+
{ allowExpressions: false },
124126
],
125127
'@typescript-eslint/explicit-member-accessibility': [
126128
'error',
127-
{accessibility: 'explicit'},
129+
{ accessibility: 'explicit' },
128130
],
129131
'@typescript-eslint/explicit-module-boundary-types': 'error',
130132
'@typescript-eslint/no-empty-function': ['warn'],
131133
'@typescript-eslint/no-extraneous-class': [
132134
'error',
133-
{allowConstructorOnly: false},
135+
{ allowConstructorOnly: false },
134136
],
135137
'@typescript-eslint/no-explicit-any': 'error',
136138
'@typescript-eslint/no-inferrable-types': 'off',
137139
'@typescript-eslint/no-magic-numbers': [
138140
'warn',
139-
{ignoreEnums: true, ignore: [0, 1], enforceConst: true},
141+
{ ignoreEnums: true, ignore: [0, 1], enforceConst: true },
140142
],
141143
'@typescript-eslint/no-namespace': 'off',
142144
'@typescript-eslint/no-unsafe-member-access': 'warn',
143145
'@typescript-eslint/no-unused-vars': [
144146
'error',
145-
{argsIgnorePattern: '^_'},
147+
{ argsIgnorePattern: '^_' },
146148
],
147149
'@typescript-eslint/prefer-function-type': 'warn',
148150
'@typescript-eslint/prefer-readonly': 'warn',
@@ -187,9 +189,9 @@ export default tseslint.config(
187189

188190
{
189191
files: ['**/*.test.ts', '**/*.spec.ts', '**/*.test.tsx', '**/*.spec.tsx'],
190-
plugins: {jest: eslintPluginJest},
192+
plugins: { jest: eslintPluginJest },
191193
settings: {
192-
jest: {version: 29},
194+
jest: { version: 29 },
193195
},
194196
},
195197
],

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"format:c": "prettier --check .",
1111
"format:w": "prettier --write .",
1212
"test": "jest",
13-
"test:cov": "jest --coverage"
13+
"test:cov": "jest --coverage",
14+
"prisma:reset": "prisma migrate reset",
15+
"prisma:migrate": "prisma migrate dev --name"
1416
},
1517
"dependencies": {
1618
"@emotion/react": "^11.14.0",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Warnings:
3+
4+
- The primary key for the `Vault` table will be changed. If it partially fails, the table could be left without primary key constraint.
5+
- You are about to drop the column `id` on the `Vault` table. All the data in the column will be lost.
6+
- The required column `uuid` was added to the `Vault` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
7+
8+
*/
9+
-- AlterTable
10+
ALTER TABLE "Vault" DROP CONSTRAINT "Vault_pkey",
11+
DROP COLUMN "id",
12+
ADD COLUMN "uuid" TEXT NOT NULL,
13+
ADD CONSTRAINT "Vault_pkey" PRIMARY KEY ("uuid");

prisma/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource db {
99
}
1010

1111
model Vault {
12-
id String @id @default(uuid())
12+
uuid String @id @default(uuid())
1313
label String @db.VarChar(255)
1414
secret String @db.VarChar(255)
1515
}

src/app/api/layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { JSX } from 'react';
22
import React from 'react';
33
import type { Metadata } from 'next';
4+
import type { SharedLayoutProps } from '@shared/types/props/SharedLayoutProps';
45

56
export const metadata: Metadata = {
67
title: 'LockLite API',
@@ -9,9 +10,7 @@ export const metadata: Metadata = {
910

1011
export default function RootLayout({
1112
children,
12-
}: {
13-
children: React.ReactNode;
14-
}): JSX.Element {
13+
}: SharedLayoutProps): JSX.Element {
1514
return (
1615
// eslint-disable-next-line no-restricted-syntax
1716
<html lang="en">

src/app/ui/layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44
import ThemeRegistry from '@ui/providers/ThemeRegistry';
55
import { AppBar, Container, Toolbar, Typography } from '@mui/material';
66
import PageContainer from '@ui/components/common/PageContainer';
7+
import type { SharedLayoutProps } from '@shared/types/props/SharedLayoutProps';
78

89
export const metadata: Metadata = {
910
title: {
@@ -15,9 +16,7 @@ export const metadata: Metadata = {
1516

1617
export default function RootLayout({
1718
children,
18-
}: {
19-
children: React.ReactNode;
20-
}): JSX.Element {
19+
}: SharedLayoutProps): JSX.Element {
2120
return (
2221
// eslint-disable-next-line no-restricted-syntax
2322
<html lang="en" style={{ height: '100%' }}>

0 commit comments

Comments
 (0)