Encryption/schema fixes

This commit is contained in:
Isaac
2022-07-17 19:00:12 +01:00
parent 3e3ac50f08
commit 3aa9a9b2c6
3 changed files with 13 additions and 13 deletions

View File

@@ -1,12 +1,12 @@
command:
log:
admin:
changes: 'Changes'
description:
joined: '{user} {verb} {targetType}'
target:
category: 'a category'
settings: 'the settings'
differences: 'Differences'
title:
joined: '{targetType} {verb}'
target:

View File

@@ -22,7 +22,7 @@ const shouldDecrypt = ['findUnique', 'findFirst', 'findMany'];
module.exports = async (params, next) => {
if (params.args.data && shouldEncrypt.includes(params.action)) {
for (const field of fields) {
if (field in params.args.data) {
if (field in params.args.data && params.args.data[field] !== null && params.args.data[field] !== undefined) {
params.args.data[field] = cryptr.encrypt(params.args.data[field]);
}
}
@@ -32,7 +32,7 @@ module.exports = async (params, next) => {
if (result && shouldDecrypt.includes(params.action)) {
for (const field of fields) {
if (field in result) {
if (field in result && result[field] !== null && result[field] !== undefined) {
result[field] = cryptr.decrypt(params.result[field]);
}
}