Skip to content

Commit

Permalink
Merge pull request #32 from Wildboar-Software/update_prisma
Browse files Browse the repository at this point in the history
Update prisma
  • Loading branch information
JonathanWilbur authored Mar 13, 2024
2 parents e923140 + 9b5480f commit d831407
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 45 deletions.
9 changes: 6 additions & 3 deletions apps/meerkat/src/app/database/entry/addAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ async function addAttributes (
value.value.byteOffset,
value.value.byteLength,
),
// TODO: Should you just get rid of this column? Or at least not fill it in?
jer: value.toJSON() as Prisma.InputJsonValue,
jer: (value.construction === ASN1Construction.primitive)
? value.toJSON() as Prisma.InputJsonValue
: undefined,
normalized_str: normalizer?.(ctx, value),
});
}
Expand All @@ -120,7 +121,9 @@ async function addAttributes (
vwc.value.value.byteOffset,
vwc.value.value.byteLength,
),
jer: vwc.value.toJSON() as Prisma.InputJsonValue,
jer: (vwc.value.construction === ASN1Construction.primitive)
? vwc.value.toJSON() as Prisma.InputJsonValue
: undefined,
normalized_str: normalizer?.(ctx, vwc.value),
ContextValue: {
createMany: {
Expand Down
8 changes: 6 additions & 2 deletions apps/meerkat/src/app/database/entry/addValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ async function addValues(
attr.value.value.byteOffset,
attr.value.value.byteLength,
),
jer: attr.value.toJSON() as Prisma.InputJsonValue,
jer: (attr.value.construction === ASN1Construction.primitive)
? attr.value.toJSON() as Prisma.InputJsonValue
: undefined,
normalized_str: normalizerGetter(attr.type)?.(ctx, attr.value),
})),
}),
Expand All @@ -373,7 +375,9 @@ async function addValues(
attr.value.value.byteOffset,
attr.value.value.byteLength,
),
jer: attr.value.toJSON() as Prisma.InputJsonValue,
jer: (attr.value.construction === ASN1Construction.primitive)
? attr.value.toJSON() as Prisma.InputJsonValue
: undefined,
normalized_str: normalizerGetter(attr.type)?.(ctx, attr.value),
ContextValue: {
createMany: {
Expand Down
12 changes: 9 additions & 3 deletions apps/meerkat/src/app/password/checkPasswordQuality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,21 @@ async function checkPasswordQuality (
return CHECK_PWD_QUALITY_LENGTH;
}

const alphabet: string[] = (await ctx.db.attributeValue.findFirst({
const alphabetResult = await ctx.db.attributeValue.findFirst({
where: {
entry_id: subentry.dse.id,
type_oid: pwdAlphabet["&id"].toBytes(),
},
select: {
jer: true,
tag_class: true,
tag_number: true,
constructed: true,
content_octets: true,
},
}))?.jer as string[] ?? [];
});
const alphabet = alphabetResult
? pwdAlphabet.decoderFor["&Type"]!(attributeValueFromDB(alphabetResult))
: [];

const passwordCharacters: Set<string> = new Set(Array.from(password));
// TODO: Unit testing to ensure the continue-to-label works as expected.
Expand Down
1 change: 1 addition & 0 deletions apps/meerkat/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ datasource db {

generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins"]
}

// Subentry attributes, such as those documented in X.501, Section 14.4.3,
Expand Down
131 changes: 96 additions & 35 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@nestjs/swagger": "^6.1.4",
"@nestjs/terminus": "^9.1.4",
"@nx/webpack": "^16.7.4",
"@prisma/client": "^5.2.0",
"@prisma/client": "^5.11.0",
"@wildboar/acse": "^1.0.7",
"@wildboar/cms": "^1.0.6",
"@wildboar/copp": "^1.0.4",
Expand Down Expand Up @@ -143,7 +143,7 @@
"nx-cloud": "16.3.0",
"prettier": "2.8.3",
"prettier-plugin-organize-imports": "^3.2.2",
"prisma": "^5.2.0",
"prisma": "^5.11.0",
"sloc": "^0.2.1",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
Expand Down

0 comments on commit d831407

Please sign in to comment.