pangea-server 3.3.146 → 3.3.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,11 +22,16 @@ class Db {
22
22
  instance = await scopedModel.findByPk(filters, { ...baseOptions, ...getInclude(model) });
23
23
  }
24
24
  else {
25
- instance = await scopedModel.findOne({
25
+ const idRow = await scopedModel.findOne({
26
26
  ...baseOptions,
27
27
  ...getInclude(model, { where: filters }),
28
+ attributes: [[(0, sequelize_1.col)(`${model.name}.id`), 'id']],
28
29
  order: getFinalOrder(order),
30
+ raw: true,
29
31
  });
32
+ if (!idRow)
33
+ return null;
34
+ instance = await scopedModel.findByPk(idRow.id, { ...baseOptions, ...getInclude(model, { where: filters }) });
30
35
  }
31
36
  if (!instance)
32
37
  return null;
@@ -55,6 +55,8 @@ class FileStorage {
55
55
  static async UploadFile(file, folder, previousFile) {
56
56
  if (previousFile)
57
57
  await this.DeleteFile(previousFile);
58
+ if (Buffer.isBuffer(file))
59
+ return uploadFile(file, { folder, fileType: 'application/octet-stream' });
58
60
  if (typeof file === 'string') {
59
61
  const buffer = await promises_1.default.readFile(path_1.default.join(process.cwd(), file));
60
62
  return uploadFile(buffer, { folder, fileType: 'application/octet-stream' });
@@ -22,5 +22,5 @@ declare global {
22
22
  type TimeStr = string;
23
23
  type MulterFile = Express.Multer.File;
24
24
  type UploadableImage = string | MulterFile;
25
- type UploadableFile = string | MulterFile;
25
+ type UploadableFile = string | Buffer | MulterFile;
26
26
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.146",
4
+ "version": "3.3.148",
5
5
  "engines": {
6
6
  "node": "22.14.0"
7
7
  },