@kipicore/dbcore 1.1.163 → 1.1.165

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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+ const up = async (queryInterface, Sequelize) => {
3
+ const table = await queryInterface.describeTable('entity_group');
4
+ if (!table.academic_calendar_id) {
5
+ await queryInterface.addColumn('entity_group', 'academic_calendar_id', {
6
+ type: Sequelize.UUID,
7
+ defaultValue: null,
8
+ allowNull: true,
9
+ field: 'academic_calendar_id',
10
+ });
11
+ }
12
+ };
13
+ const down = async (queryInterface, Sequelize) => {
14
+ const table = await queryInterface.describeTable('entity_group');
15
+ if (table.academic_calendar_id) {
16
+ await queryInterface.removeColumn('entity_group', 'academic_calendar_id');
17
+ }
18
+ };
19
+ module.exports = {
20
+ up,
21
+ down,
22
+ };
@@ -1,6 +1,11 @@
1
1
  import { Document } from 'mongoose';
2
2
  import { IDefaultAttributes } from './commonInterface';
3
3
  import { CAMPUS_CARNIVAL_STATUS } from '../constants/app';
4
+ export interface IMaxParticipantsPerStandardAttributes {
5
+ standardId: string;
6
+ numberOfCompetition: number;
7
+ maxParticipants: number;
8
+ }
4
9
  export interface ICampusCarnivalModelAttributes extends IDefaultAttributes, Document {
5
10
  id: string;
6
11
  name: string;
@@ -11,4 +16,5 @@ export interface ICampusCarnivalModelAttributes extends IDefaultAttributes, Docu
11
16
  status: CAMPUS_CARNIVAL_STATUS;
12
17
  academicCalendarId: string;
13
18
  instituteId: string;
19
+ maxParticipantsPerStandard: [IMaxParticipantsPerStandardAttributes];
14
20
  }
@@ -11,8 +11,6 @@ export interface IRoundsInformationAttributes {
11
11
  }
12
12
  export interface IStandardsInformationAttributes {
13
13
  standardId: string;
14
- numberOfParticipants: number;
15
- maxParticipants: number;
16
14
  batchId: string[];
17
15
  }
18
16
  export interface ICompetitionAttributes extends IDefaultAttributes, Document {
@@ -30,7 +28,7 @@ export interface ICompetitionAttributes extends IDefaultAttributes, Document {
30
28
  status: CAMPUS_CARNIVAL_STATUS;
31
29
  judges: string[];
32
30
  coordinator: string[];
33
- standards: [IStandardsInformationAttributes];
31
+ standards: IStandardsInformationAttributes[];
34
32
  academicCalendarId: string;
35
33
  instituteId: string;
36
34
  campusCarnivalId: string;
@@ -1,7 +1,7 @@
1
1
  import { Document } from 'mongoose';
2
2
  import { IDefaultAttributes } from './commonInterface';
3
3
  import { COMPETITION_STATUS, COMPETITION_USER_ROLE, RESULT_STATUS, STATUS_BY_PARENTS } from '../constants/app';
4
- export interface IRoleAttributionSchema {
4
+ export interface IRoundsAttributionSchema {
5
5
  id: string;
6
6
  status: COMPETITION_STATUS;
7
7
  rank: number;
@@ -15,7 +15,7 @@ export interface ICompetitionUsersModelAttributes extends IDefaultAttributes, Do
15
15
  statusByParent: STATUS_BY_PARENTS;
16
16
  userId: string;
17
17
  groupId: string;
18
- round: IRoleAttributionSchema[];
18
+ round: IRoundsAttributionSchema[];
19
19
  competitionId: string;
20
20
  competitionEventId: string;
21
21
  userRole: COMPETITION_USER_ROLE;
@@ -7,6 +7,7 @@ export interface IEntityGroupModelAttributes extends IDefaultAttributes {
7
7
  isDefault: boolean;
8
8
  entityIds: string[];
9
9
  instituteId: string;
10
+ academicCalendarId?: string;
10
11
  status: COMMAN_STATUS;
11
12
  selectionCount: number;
12
13
  }
@@ -1,4 +1,4 @@
1
- import { Model } from "mongoose";
2
- import { ICampusCarnivalModelAttributes } from "../../interfaces/campusCarnivalInterface";
1
+ import { Model } from 'mongoose';
2
+ import { ICampusCarnivalModelAttributes } from '../../interfaces/campusCarnivalInterface';
3
3
  declare const CampusCarnivalModel: Model<ICampusCarnivalModelAttributes>;
4
4
  export default CampusCarnivalModel;
@@ -35,6 +35,21 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const mongoose_1 = __importStar(require("mongoose"));
37
37
  const app_1 = require("../../constants/app");
38
+ const MaxParticipantsPerStandardAttributes = new mongoose_1.Schema({
39
+ standardId: {
40
+ type: String,
41
+ required: false,
42
+ },
43
+ numberOfCompetition: {
44
+ type: Number,
45
+ required: false,
46
+ },
47
+ maxParticipants: {
48
+ type: Number,
49
+ required: false,
50
+ default: -1,
51
+ },
52
+ });
38
53
  const CampusCarnivalSchema = new mongoose_1.Schema({
39
54
  name: {
40
55
  type: String,
@@ -69,6 +84,10 @@ const CampusCarnivalSchema = new mongoose_1.Schema({
69
84
  type: String,
70
85
  required: false,
71
86
  },
87
+ maxParticipantsPerStandard: {
88
+ type: [MaxParticipantsPerStandardAttributes],
89
+ required: false,
90
+ },
72
91
  createdBy: {
73
92
  type: String,
74
93
  },
@@ -82,5 +101,5 @@ const CampusCarnivalSchema = new mongoose_1.Schema({
82
101
  timestamps: true,
83
102
  versionKey: false,
84
103
  });
85
- const CampusCarnivalModel = mongoose_1.default.model("campus_carnival", CampusCarnivalSchema);
104
+ const CampusCarnivalModel = mongoose_1.default.model('campus_carnival', CampusCarnivalSchema);
86
105
  exports.default = CampusCarnivalModel;
@@ -67,14 +67,6 @@ const StandardsInformationSchema = new mongoose_1.Schema({
67
67
  type: String,
68
68
  required: false,
69
69
  },
70
- numberOfParticipants: {
71
- type: Number,
72
- required: false,
73
- },
74
- maxParticipants: {
75
- type: Number,
76
- required: false,
77
- },
78
70
  batchId: {
79
71
  type: [String],
80
72
  required: false,
@@ -8,6 +8,7 @@ export declare class EntityGroupModel extends Model<IEntityGroupModelAttributes,
8
8
  isDefault: boolean;
9
9
  standardId: string;
10
10
  instituteId: string;
11
+ academicCalendarId: string;
11
12
  entityIds: string[];
12
13
  status: COMMAN_STATUS;
13
14
  selectionCount: number;
@@ -6,7 +6,7 @@ const app_1 = require("../../constants/app");
6
6
  const index_1 = require("./index");
7
7
  class EntityGroupModel extends sequelize_1.Model {
8
8
  static associate(models) {
9
- const { UserModel, InstituteEntityModel } = models;
9
+ const { UserModel, InstituteEntityModel, AcademicCalendarModel } = models;
10
10
  EntityGroupModel.belongsTo(UserModel, {
11
11
  foreignKey: { name: 'createdBy', allowNull: true, field: 'created_by' },
12
12
  as: 'createdByUser',
@@ -27,6 +27,14 @@ class EntityGroupModel extends sequelize_1.Model {
27
27
  foreignKey: { name: 'standardId', allowNull: true, field: 'standard_id' },
28
28
  as: 'entityGroupStandard',
29
29
  });
30
+ EntityGroupModel.belongsTo(AcademicCalendarModel, {
31
+ foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
32
+ as: 'academicEntityGroup',
33
+ });
34
+ AcademicCalendarModel.hasMany(EntityGroupModel, {
35
+ foreignKey: { name: 'academicCalendarId', allowNull: true, field: 'academic_calendar_id' },
36
+ as: 'entityGroupAcademic',
37
+ });
30
38
  }
31
39
  }
32
40
  exports.EntityGroupModel = EntityGroupModel;
@@ -51,6 +59,11 @@ EntityGroupModel.init({
51
59
  field: 'institute_id',
52
60
  allowNull: true,
53
61
  },
62
+ academicCalendarId: {
63
+ type: sequelize_1.DataTypes.UUID,
64
+ field: 'academic_calendar_id',
65
+ allowNull: true,
66
+ },
54
67
  isDefault: {
55
68
  type: sequelize_1.DataTypes.BOOLEAN,
56
69
  defaultValue: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.163",
3
+ "version": "1.1.165",
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",