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",
"@types/pouchdb": "^6.4.0",
"pouchdb": "^8.0.1",
"pouchdb-server": "^4.2.0"
"pouchdb-server": "^4.2.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@solidjs/meta": "^0.28.2",
@ -19,6 +20,7 @@
"@solidjs/testing-library": "^0.5.2",
"@testing-library/jest-dom": "^5.16.5",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/uuid": "^9.0.0",
"@vitest/coverage-c8": "^0.26.3",
"@vitest/ui": "^0.26.3",
"jsdom": "^20.0.3",
@ -2863,6 +2865,12 @@
"@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": {
"version": "17.0.22",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.22.tgz",
@ -8401,6 +8409,14 @@
"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": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/pouchdb-validation/-/pouchdb-validation-4.2.0.tgz",
@ -8432,6 +8448,14 @@
"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": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
@ -10043,9 +10067,9 @@
}
},
"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==",
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
"bin": {
"uuid": "dist/bin/uuid"
}

View File

@ -16,6 +16,7 @@
"@solidjs/testing-library": "^0.5.2",
"@testing-library/jest-dom": "^5.16.5",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/uuid": "^9.0.0",
"@vitest/coverage-c8": "^0.26.3",
"@vitest/ui": "^0.26.3",
"jsdom": "^20.0.3",
@ -33,6 +34,7 @@
"@kobalte/core": "^0.6.1",
"@types/pouchdb": "^6.4.0",
"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 { createServerAction$ } from "solid-start/server";
import PouchDb from "pouchdb";
import { v4 as uuid } from "uuid";
interface Props {}
const Invitation: Component<Props> = (props) => {
const [saving, save] = createServerAction$(async (values: any) => {
const db = new PouchDb(".db");
const uuid = createUniqueId();
const id = `invitation/${uuid()}}`;
await db.put({
_id: `invitation/${uuid}`,
_id: id,
type: "invitation",
doc: values,
});
return id;
});
const submitHandler = (values: any, context: any) => {

View File

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