Using a real uuid

This commit is contained in:
Eric van der Vlist 2023-02-21 16:12:52 +01:00
parent fbdb652bd7
commit c8cb8d47a2
4 changed files with 36 additions and 8 deletions

32
package-lock.json generated
View File

@ -11,7 +11,8 @@
"@kobalte/core": "^0.6.1", "@kobalte/core": "^0.6.1",
"@types/pouchdb": "^6.4.0", "@types/pouchdb": "^6.4.0",
"pouchdb": "^8.0.1", "pouchdb": "^8.0.1",
"pouchdb-server": "^4.2.0" "pouchdb-server": "^4.2.0",
"uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@solidjs/meta": "^0.28.2", "@solidjs/meta": "^0.28.2",
@ -19,6 +20,7 @@
"@solidjs/testing-library": "^0.5.2", "@solidjs/testing-library": "^0.5.2",
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@types/testing-library__jest-dom": "^5.14.5", "@types/testing-library__jest-dom": "^5.14.5",
"@types/uuid": "^9.0.0",
"@vitest/coverage-c8": "^0.26.3", "@vitest/coverage-c8": "^0.26.3",
"@vitest/ui": "^0.26.3", "@vitest/ui": "^0.26.3",
"jsdom": "^20.0.3", "jsdom": "^20.0.3",
@ -2863,6 +2865,12 @@
"@types/jest": "*" "@types/jest": "*"
} }
}, },
"node_modules/@types/uuid": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==",
"dev": true
},
"node_modules/@types/yargs": { "node_modules/@types/yargs": {
"version": "17.0.22", "version": "17.0.22",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
@ -8401,6 +8409,14 @@
"uuid": "8.3.2" "uuid": "8.3.2"
} }
}, },
"node_modules/pouchdb-utils/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/pouchdb-validation": { "node_modules/pouchdb-validation": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/pouchdb-validation/-/pouchdb-validation-4.2.0.tgz", "resolved": "https://registry.npmjs.org/pouchdb-validation/-/pouchdb-validation-4.2.0.tgz",
@ -8432,6 +8448,14 @@
"promise-nodify": "^1.0.2" "promise-nodify": "^1.0.2"
} }
}, },
"node_modules/pouchdb/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/prelude-ls": { "node_modules/prelude-ls": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
@ -10043,9 +10067,9 @@
} }
}, },
"node_modules/uuid": { "node_modules/uuid": {
"version": "8.3.2", "version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
"bin": { "bin": {
"uuid": "dist/bin/uuid" "uuid": "dist/bin/uuid"
} }

View File

@ -16,6 +16,7 @@
"@solidjs/testing-library": "^0.5.2", "@solidjs/testing-library": "^0.5.2",
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@types/testing-library__jest-dom": "^5.14.5", "@types/testing-library__jest-dom": "^5.14.5",
"@types/uuid": "^9.0.0",
"@vitest/coverage-c8": "^0.26.3", "@vitest/coverage-c8": "^0.26.3",
"@vitest/ui": "^0.26.3", "@vitest/ui": "^0.26.3",
"jsdom": "^20.0.3", "jsdom": "^20.0.3",
@ -33,6 +34,7 @@
"@kobalte/core": "^0.6.1", "@kobalte/core": "^0.6.1",
"@types/pouchdb": "^6.4.0", "@types/pouchdb": "^6.4.0",
"pouchdb": "^8.0.1", "pouchdb": "^8.0.1",
"pouchdb-server": "^4.2.0" "pouchdb-server": "^4.2.0",
"uuid": "^9.0.0"
} }
} }

View File

@ -5,18 +5,20 @@ import { TextField, Button } from "@kobalte/core";
import "./style.css"; import "./style.css";
import { createServerAction$ } from "solid-start/server"; import { createServerAction$ } from "solid-start/server";
import PouchDb from "pouchdb"; import PouchDb from "pouchdb";
import { v4 as uuid } from "uuid";
interface Props {} interface Props {}
const Invitation: Component<Props> = (props) => { const Invitation: Component<Props> = (props) => {
const [saving, save] = createServerAction$(async (values: any) => { const [saving, save] = createServerAction$(async (values: any) => {
const db = new PouchDb(".db"); const db = new PouchDb(".db");
const uuid = createUniqueId(); const id = `invitation/${uuid()}}`;
await db.put({ await db.put({
_id: `invitation/${uuid}`, _id: id,
type: "invitation", type: "invitation",
doc: values, doc: values,
}); });
return id;
}); });
const submitHandler = (values: any, context: any) => { const submitHandler = (values: any, context: any) => {

View File

@ -23,7 +23,7 @@ const Invitations: Component<Props> = (props) => {
createEffect(() => { createEffect(() => {
console.log({ console.log({
caller: "Invitations", caller: "Invitations",
routeData: invitations.result, invitations: invitations.result,
}); });
}); });