@kipicore/dbcore 1.1.57 → 1.1.59

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.
@@ -6,6 +6,6 @@ export interface ICanteenModelAttributes extends IDefaultAttributes, Document {
6
6
  date: Date;
7
7
  menu: string[];
8
8
  instituteId: string;
9
- academicYearId: string;
9
+ academicCalendarId: string;
10
10
  status: COMMAN_STATUS;
11
11
  }
@@ -37,24 +37,21 @@ const mongoose_1 = __importStar(require("mongoose"));
37
37
  const app_1 = require("../../constants/app");
38
38
  const canteenSchema = new mongoose_1.Schema({
39
39
  date: {
40
- type: Date,
41
- required: true,
42
- trim: true,
40
+ type: Date
43
41
  },
44
42
  menu: {
45
43
  type: [String],
46
- trim: true,
47
44
  },
48
45
  instituteId: {
49
46
  type: String,
50
47
  },
51
- academicYearId: {
48
+ academicCalendarId: {
52
49
  type: String,
53
50
  },
54
51
  status: {
55
52
  type: String,
56
53
  enum: Object.values(app_1.COMMAN_STATUS),
57
- }
54
+ },
58
55
  }, {
59
56
  timestamps: true,
60
57
  versionKey: false,
@@ -5,7 +5,7 @@ const index_1 = require("./index");
5
5
  const app_1 = require("../../constants/app");
6
6
  class LostFoundItemModel extends sequelize_1.Model {
7
7
  static associate(models) {
8
- const { UserModel, InstituteModel, AcademicCalendarModel } = models;
8
+ const { UserModel, InstituteModel, AcademicCalendarModel, FileStorageModel } = models;
9
9
  LostFoundItemModel.belongsTo(UserModel, {
10
10
  foreignKey: {
11
11
  name: 'createdBy',
@@ -54,6 +54,14 @@ class LostFoundItemModel extends sequelize_1.Model {
54
54
  foreignKey: 'academicCalendarId',
55
55
  as: 'academicCalendarIdHasLostFound',
56
56
  });
57
+ LostFoundItemModel.belongsTo(FileStorageModel, {
58
+ foreignKey: { name: 'fileStorageId', field: 'file_storage_id' },
59
+ as: 'lostFoundItemFileStorage',
60
+ });
61
+ FileStorageModel.hasMany(LostFoundItemModel, {
62
+ foreignKey: { name: 'fileStorageId', field: 'file_storage_id' },
63
+ as: 'lostFoundItemHasFileList',
64
+ });
57
65
  }
58
66
  }
59
67
  LostFoundItemModel.init({
@@ -1,2 +1,6 @@
1
- import { ICanteenModelAttributes } from "../interfaces/canteenInterface";
1
+ import { ICanteenModelAttributes } from '../interfaces/canteenInterface';
2
+ import { IInstituteAttributes } from '../interfaces';
2
3
  export type TCanteenModelCreationAttributes = Omit<ICanteenModelAttributes, 'id'>;
4
+ export type TCanteenWithInstitute = ICanteenModelAttributes & {
5
+ instituteDetails?: IInstituteAttributes;
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.57",
3
+ "version": "1.1.59",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",