c2-climbing-x 1.0.1
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.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +22 -0
- package/dist/models/Challenge.d.ts +11 -0
- package/dist/models/Challenge.js +21 -0
- package/dist/models/ChallengeRound.d.ts +15 -0
- package/dist/models/ChallengeRound.js +23 -0
- package/dist/models/Championship.d.ts +15 -0
- package/dist/models/Championship.js +21 -0
- package/dist/models/ChampionshipMatch.d.ts +21 -0
- package/dist/models/ChampionshipMatch.js +29 -0
- package/dist/models/ChampionshipPhase.d.ts +35 -0
- package/dist/models/ChampionshipPhase.js +40 -0
- package/dist/models/ChampionshipRound.d.ts +18 -0
- package/dist/models/ChampionshipRound.js +32 -0
- package/dist/models/Match.d.ts +17 -0
- package/dist/models/Match.js +26 -0
- package/dist/models/Phase.d.ts +13 -0
- package/dist/models/Phase.js +27 -0
- package/dist/models/Round.d.ts +16 -0
- package/dist/models/Round.js +31 -0
- package/dist/models/Team.d.ts +13 -0
- package/dist/models/Team.js +20 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +17 -0
- package/dist/types/GroupMatchMode.d.ts +9 -0
- package/dist/types/GroupMatchMode.js +13 -0
- package/dist/types/MatchStatus.d.ts +11 -0
- package/dist/types/MatchStatus.js +15 -0
- package/dist/types/Modality.d.ts +15 -0
- package/dist/types/Modality.js +19 -0
- package/dist/types/PhaseType.d.ts +8 -0
- package/dist/types/PhaseType.js +12 -0
- package/dist/types/QualificationMode.d.ts +10 -0
- package/dist/types/QualificationMode.js +14 -0
- package/dist/types/RoundStatus.d.ts +9 -0
- package/dist/types/RoundStatus.js +13 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +15 -0
- package/package.json +33 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* c2-climbing-x — Modelagem Escalada X
|
|
4
|
+
* Times, campeonatos, fases, rodadas, confrontos, desafios e rodadas do desafio.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
__exportStar(require("./models"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { IChampionship } from "./Championship";
|
|
3
|
+
export interface IChallenge {
|
|
4
|
+
_id: Types.ObjectId;
|
|
5
|
+
championship: Types.ObjectId | IChampionship;
|
|
6
|
+
roundStart: number;
|
|
7
|
+
roundEnd: number;
|
|
8
|
+
createdAtDateTime: Date;
|
|
9
|
+
updatedAtDateTime: Date;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChallengeModel: Model<IChallenge>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChallengeModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const ChallengeSchema = new mongoose_1.Schema({
|
|
6
|
+
championship: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "championship",
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
roundStart: { type: Number, required: true },
|
|
12
|
+
roundEnd: { type: Number, required: true }
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: {
|
|
15
|
+
createdAt: "createdAtDateTime",
|
|
16
|
+
updatedAt: "updatedAtDateTime"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
ChallengeSchema.index({ championship: 1 });
|
|
20
|
+
ChallengeSchema.index({ championship: 1, roundStart: 1, roundEnd: 1 });
|
|
21
|
+
exports.ChallengeModel = (0, mongoose_1.model)("challenge", ChallengeSchema);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { IChallenge } from "./Challenge";
|
|
3
|
+
import { IChampionshipRound } from "./ChampionshipRound";
|
|
4
|
+
import { IChampionshipMatch } from "./ChampionshipMatch";
|
|
5
|
+
export interface IChallengeRound {
|
|
6
|
+
_id: Types.ObjectId;
|
|
7
|
+
challenge: Types.ObjectId | IChallenge;
|
|
8
|
+
round: Types.ObjectId | IChampionshipRound;
|
|
9
|
+
matches?: Types.ObjectId[] | IChampionshipMatch[];
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
sequenceOrder?: number;
|
|
12
|
+
createdAtDateTime: Date;
|
|
13
|
+
updatedAtDateTime: Date;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChallengeRoundModel: Model<IChallengeRound>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChallengeRoundModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const ChallengeRoundSchema = new mongoose_1.Schema({
|
|
6
|
+
challenge: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "challenge",
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
round: { type: mongoose_1.Schema.Types.ObjectId, ref: "championship-round", required: true },
|
|
12
|
+
matches: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "match", required: false }],
|
|
13
|
+
enabled: { type: Boolean, required: true, default: true },
|
|
14
|
+
sequenceOrder: { type: Number, required: false }
|
|
15
|
+
}, {
|
|
16
|
+
timestamps: {
|
|
17
|
+
createdAt: "createdAtDateTime",
|
|
18
|
+
updatedAt: "updatedAtDateTime"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
ChallengeRoundSchema.index({ challenge: 1 });
|
|
22
|
+
ChallengeRoundSchema.index({ challenge: 1, round: 1 }, { unique: true });
|
|
23
|
+
exports.ChallengeRoundModel = (0, mongoose_1.model)("challenge-round", ChallengeRoundSchema);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { ITeam } from "./Team";
|
|
3
|
+
import { Modality } from "../types/Modality";
|
|
4
|
+
export interface IChampionship {
|
|
5
|
+
_id: Types.ObjectId;
|
|
6
|
+
name: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
startDate?: Date;
|
|
9
|
+
endDate?: Date;
|
|
10
|
+
teams: Types.ObjectId[] | ITeam[];
|
|
11
|
+
modality: Modality;
|
|
12
|
+
createdAtDateTime: Date;
|
|
13
|
+
updatedAtDateTime: Date;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChampionshipModel: Model<IChampionship>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChampionshipModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const Modality_1 = require("../types/Modality");
|
|
6
|
+
const ChampionshipSchema = new mongoose_1.Schema({
|
|
7
|
+
name: { type: String, required: true },
|
|
8
|
+
slug: { type: String, required: false },
|
|
9
|
+
startDate: { type: Date, required: false },
|
|
10
|
+
endDate: { type: Date, required: false },
|
|
11
|
+
teams: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true }],
|
|
12
|
+
modality: { type: String, required: true, enum: Modality_1.Modality }
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: {
|
|
15
|
+
createdAt: "createdAtDateTime",
|
|
16
|
+
updatedAt: "updatedAtDateTime"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
ChampionshipSchema.index({ slug: 1 }, { unique: true, sparse: true });
|
|
20
|
+
ChampionshipSchema.index({ modality: 1 });
|
|
21
|
+
exports.ChampionshipModel = (0, mongoose_1.model)("championship", ChampionshipSchema);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { MatchStatus } from "../types/MatchStatus";
|
|
3
|
+
import { IChampionshipRound } from "./ChampionshipRound";
|
|
4
|
+
import { ITeam } from "./Team";
|
|
5
|
+
import { IChampionshipPhase } from "./ChampionshipPhase";
|
|
6
|
+
export interface IChampionshipMatch {
|
|
7
|
+
_id: Types.ObjectId;
|
|
8
|
+
number: number;
|
|
9
|
+
phase: Types.ObjectId | IChampionshipPhase;
|
|
10
|
+
round: Types.ObjectId | IChampionshipRound;
|
|
11
|
+
group?: string;
|
|
12
|
+
homeTeam: Types.ObjectId | ITeam;
|
|
13
|
+
awayTeam: Types.ObjectId | ITeam;
|
|
14
|
+
scheduledAt?: Date;
|
|
15
|
+
homeScore?: number;
|
|
16
|
+
awayScore?: number;
|
|
17
|
+
status: MatchStatus;
|
|
18
|
+
createdAtDateTime: Date;
|
|
19
|
+
updatedAtDateTime: Date;
|
|
20
|
+
}
|
|
21
|
+
export declare const MatchModel: Model<IChampionshipMatch>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatchModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const MatchStatus_1 = require("../types/MatchStatus");
|
|
6
|
+
const ChampionshipMatchSchema = new mongoose_1.Schema({
|
|
7
|
+
number: { type: Number, required: true },
|
|
8
|
+
phase: { type: mongoose_1.Schema.Types.ObjectId, ref: "championship-phase", required: true },
|
|
9
|
+
round: { type: mongoose_1.Schema.Types.ObjectId, ref: "championship-round", required: true },
|
|
10
|
+
group: { type: String, required: false },
|
|
11
|
+
homeTeam: { type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true },
|
|
12
|
+
awayTeam: { type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true },
|
|
13
|
+
scheduledAt: { type: Date, required: false },
|
|
14
|
+
homeScore: { type: Number, required: false },
|
|
15
|
+
awayScore: { type: Number, required: false },
|
|
16
|
+
status: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
enum: MatchStatus_1.MatchStatus
|
|
20
|
+
},
|
|
21
|
+
}, {
|
|
22
|
+
timestamps: {
|
|
23
|
+
createdAt: "createdAtDateTime",
|
|
24
|
+
updatedAt: "updatedAtDateTime"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
ChampionshipMatchSchema.index({ round: 1 });
|
|
28
|
+
ChampionshipMatchSchema.index({ round: 1, homeTeam: 1, awayTeam: 1 }, { unique: true });
|
|
29
|
+
exports.MatchModel = (0, mongoose_1.model)("championship-match", ChampionshipMatchSchema);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { GroupMatchMode } from "../types/GroupMatchMode";
|
|
3
|
+
import { QualificationMode } from "../types/QualificationMode";
|
|
4
|
+
import { IChampionship } from "./Championship";
|
|
5
|
+
import { ITeam } from "./Team";
|
|
6
|
+
/** Time na fase, com identificador opcional de grupo (ex.: "A", "B" na fase de grupos). */
|
|
7
|
+
export interface IPhaseParticipant {
|
|
8
|
+
team: Types.ObjectId | ITeam;
|
|
9
|
+
group?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IChampionshipPhase {
|
|
12
|
+
_id: Types.ObjectId;
|
|
13
|
+
description: string;
|
|
14
|
+
championship: Types.ObjectId | IChampionship;
|
|
15
|
+
order: number;
|
|
16
|
+
/** Times da fase; cada item pode ter um identificador de grupo (ex.: Copa do Mundo). */
|
|
17
|
+
participants: IPhaseParticipant[];
|
|
18
|
+
/** Modo de disputa dos grupos . */
|
|
19
|
+
matchRules?: IMatchRules;
|
|
20
|
+
/** Modos de classificação para a próxima fase (pode ser mais de um). */
|
|
21
|
+
qualifiedRules: IQualifiedRule[];
|
|
22
|
+
createdAtDateTime: Date;
|
|
23
|
+
updatedAtDateTime: Date;
|
|
24
|
+
}
|
|
25
|
+
export interface IMatchRules {
|
|
26
|
+
mode: GroupMatchMode;
|
|
27
|
+
twoLegs: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface IQualifiedRule {
|
|
30
|
+
priority: number;
|
|
31
|
+
mode: QualificationMode;
|
|
32
|
+
position: number;
|
|
33
|
+
limit: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const ChampionshipPhaseModel: Model<IChampionshipPhase>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChampionshipPhaseModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const GroupMatchMode_1 = require("../types/GroupMatchMode");
|
|
6
|
+
const QualificationMode_1 = require("../types/QualificationMode");
|
|
7
|
+
const PhaseParticipantSchema = new mongoose_1.Schema({
|
|
8
|
+
team: { type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true },
|
|
9
|
+
group: { type: String, required: false }
|
|
10
|
+
}, { _id: false });
|
|
11
|
+
const QualifiedRuleSchema = new mongoose_1.Schema({
|
|
12
|
+
priority: { type: Number, required: true },
|
|
13
|
+
mode: { type: String, required: true, enum: QualificationMode_1.QualificationMode },
|
|
14
|
+
position: { type: Number, required: true },
|
|
15
|
+
limit: { type: Number, required: true },
|
|
16
|
+
});
|
|
17
|
+
const MatchRulesSchema = new mongoose_1.Schema({
|
|
18
|
+
mode: { type: String, required: true, enum: GroupMatchMode_1.GroupMatchMode },
|
|
19
|
+
twoLegs: { type: Boolean, required: true, default: false },
|
|
20
|
+
});
|
|
21
|
+
const ChampionshipPhaseSchema = new mongoose_1.Schema({
|
|
22
|
+
description: { type: String, required: true },
|
|
23
|
+
championship: {
|
|
24
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
25
|
+
ref: "championship",
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
order: { type: Number, required: true },
|
|
29
|
+
participants: { type: [PhaseParticipantSchema], required: true, default: [] },
|
|
30
|
+
matchRules: { type: MatchRulesSchema, required: true },
|
|
31
|
+
qualifiedRules: { type: [QualifiedRuleSchema], required: true }
|
|
32
|
+
}, {
|
|
33
|
+
timestamps: {
|
|
34
|
+
createdAt: "createdAtDateTime",
|
|
35
|
+
updatedAt: "updatedAtDateTime"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
ChampionshipPhaseSchema.index({ championship: 1 });
|
|
39
|
+
ChampionshipPhaseSchema.index({ championship: 1, order: 1 }, { unique: true });
|
|
40
|
+
exports.ChampionshipPhaseModel = (0, mongoose_1.model)("championship-phase", ChampionshipPhaseSchema);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { RoundStatus } from "../types/RoundStatus";
|
|
3
|
+
import { IChampionshipPhase } from "./ChampionshipPhase";
|
|
4
|
+
import { IChampionship } from "./Championship";
|
|
5
|
+
export interface IChampionshipRound {
|
|
6
|
+
_id: Types.ObjectId;
|
|
7
|
+
phase: Types.ObjectId | IChampionshipPhase;
|
|
8
|
+
championship: Types.ObjectId | IChampionship;
|
|
9
|
+
roundIndexInPhase: number;
|
|
10
|
+
globalRoundIndex: number;
|
|
11
|
+
label?: string;
|
|
12
|
+
startDate?: Date;
|
|
13
|
+
endDate?: Date;
|
|
14
|
+
status: RoundStatus;
|
|
15
|
+
createdAtDateTime: Date;
|
|
16
|
+
updatedAtDateTime: Date;
|
|
17
|
+
}
|
|
18
|
+
export declare const ChampionshipRoundModel: Model<IChampionshipRound>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChampionshipRoundModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const RoundStatus_1 = require("../types/RoundStatus");
|
|
6
|
+
const ChampionshipRoundSchema = new mongoose_1.Schema({
|
|
7
|
+
phase: { type: mongoose_1.Schema.Types.ObjectId, ref: "championship-phase", required: true },
|
|
8
|
+
championship: {
|
|
9
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
10
|
+
ref: "championship",
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
roundIndexInPhase: { type: Number, required: true },
|
|
14
|
+
globalRoundIndex: { type: Number, required: true },
|
|
15
|
+
label: { type: String, required: false },
|
|
16
|
+
startDate: { type: Date, required: false },
|
|
17
|
+
endDate: { type: Date, required: false },
|
|
18
|
+
status: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
enum: RoundStatus_1.RoundStatus
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
timestamps: {
|
|
25
|
+
createdAt: "createdAtDateTime",
|
|
26
|
+
updatedAt: "updatedAtDateTime"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
ChampionshipRoundSchema.index({ phase: 1 });
|
|
30
|
+
ChampionshipRoundSchema.index({ championship: 1 });
|
|
31
|
+
ChampionshipRoundSchema.index({ championship: 1, globalRoundIndex: 1 }, { unique: true });
|
|
32
|
+
exports.ChampionshipRoundModel = (0, mongoose_1.model)("championship-round", ChampionshipRoundSchema);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { MatchStatus } from "../types/MatchStatus";
|
|
3
|
+
import { IChampionshipRound } from "./ChampionshipRound";
|
|
4
|
+
import { ITeam } from "./Team";
|
|
5
|
+
export interface IMatch {
|
|
6
|
+
_id: Types.ObjectId;
|
|
7
|
+
round: Types.ObjectId | IChampionshipRound;
|
|
8
|
+
homeTeam: Types.ObjectId | ITeam;
|
|
9
|
+
awayTeam: Types.ObjectId | ITeam;
|
|
10
|
+
scheduledAt?: Date;
|
|
11
|
+
homeScore?: number;
|
|
12
|
+
awayScore?: number;
|
|
13
|
+
status: MatchStatus;
|
|
14
|
+
createdAtDateTime: Date;
|
|
15
|
+
updatedAtDateTime: Date;
|
|
16
|
+
}
|
|
17
|
+
export declare const MatchModel: Model<IMatch>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatchModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const MatchStatus_1 = require("../types/MatchStatus");
|
|
6
|
+
const MatchSchema = new mongoose_1.Schema({
|
|
7
|
+
round: { type: mongoose_1.Schema.Types.ObjectId, ref: "championship-round", required: true },
|
|
8
|
+
homeTeam: { type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true },
|
|
9
|
+
awayTeam: { type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true },
|
|
10
|
+
scheduledAt: { type: Date, required: false },
|
|
11
|
+
homeScore: { type: Number, required: false },
|
|
12
|
+
awayScore: { type: Number, required: false },
|
|
13
|
+
status: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
enum: MatchStatus_1.MatchStatus
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
timestamps: {
|
|
20
|
+
createdAt: "createdAtDateTime",
|
|
21
|
+
updatedAt: "updatedAtDateTime"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
MatchSchema.index({ round: 1 });
|
|
25
|
+
MatchSchema.index({ round: 1, homeTeam: 1, awayTeam: 1 }, { unique: true });
|
|
26
|
+
exports.MatchModel = (0, mongoose_1.model)("match", MatchSchema);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { PhaseType } from "../types/PhaseType";
|
|
3
|
+
export interface IPhase {
|
|
4
|
+
_id: Types.ObjectId;
|
|
5
|
+
championship: Types.ObjectId;
|
|
6
|
+
order: number;
|
|
7
|
+
type: PhaseType;
|
|
8
|
+
qualifiedForNextPhase: number;
|
|
9
|
+
teams: Types.ObjectId[];
|
|
10
|
+
createdAtDateTime: Date;
|
|
11
|
+
updatedAtDateTime: Date;
|
|
12
|
+
}
|
|
13
|
+
export declare const PhaseModel: Model<IPhase>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhaseModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const PhaseSchema = new mongoose_1.Schema({
|
|
6
|
+
championship: {
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
ref: "championship",
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
order: { type: Number, required: true },
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
enum: ["PONTO_CORRIDO", "MATA_MATA"]
|
|
16
|
+
},
|
|
17
|
+
qualifiedForNextPhase: { type: Number, required: true },
|
|
18
|
+
teams: [{ type: mongoose_1.Schema.Types.ObjectId, ref: "team", required: true }]
|
|
19
|
+
}, {
|
|
20
|
+
timestamps: {
|
|
21
|
+
createdAt: "createdAtDateTime",
|
|
22
|
+
updatedAt: "updatedAtDateTime"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
PhaseSchema.index({ championship: 1 });
|
|
26
|
+
PhaseSchema.index({ championship: 1, order: 1 }, { unique: true });
|
|
27
|
+
exports.PhaseModel = (0, mongoose_1.model)("phase", PhaseSchema);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { RoundStatus } from "../types/RoundStatus";
|
|
3
|
+
export interface IRound {
|
|
4
|
+
_id: Types.ObjectId;
|
|
5
|
+
phase: Types.ObjectId;
|
|
6
|
+
championship: Types.ObjectId;
|
|
7
|
+
roundIndexInPhase: number;
|
|
8
|
+
globalRoundIndex: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
startDate?: Date;
|
|
11
|
+
endDate?: Date;
|
|
12
|
+
status: RoundStatus;
|
|
13
|
+
createdAtDateTime: Date;
|
|
14
|
+
updatedAtDateTime: Date;
|
|
15
|
+
}
|
|
16
|
+
export declare const RoundModel: Model<IRound>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoundModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const RoundSchema = new mongoose_1.Schema({
|
|
6
|
+
phase: { type: mongoose_1.Schema.Types.ObjectId, ref: "phase", required: true },
|
|
7
|
+
championship: {
|
|
8
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
9
|
+
ref: "championship",
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
roundIndexInPhase: { type: Number, required: true },
|
|
13
|
+
globalRoundIndex: { type: Number, required: true },
|
|
14
|
+
label: { type: String, required: false },
|
|
15
|
+
startDate: { type: Date, required: false },
|
|
16
|
+
endDate: { type: Date, required: false },
|
|
17
|
+
status: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
enum: ["PENDING", "OPEN", "CLOSED"]
|
|
21
|
+
}
|
|
22
|
+
}, {
|
|
23
|
+
timestamps: {
|
|
24
|
+
createdAt: "createdAtDateTime",
|
|
25
|
+
updatedAt: "updatedAtDateTime"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
RoundSchema.index({ phase: 1 });
|
|
29
|
+
RoundSchema.index({ championship: 1 });
|
|
30
|
+
RoundSchema.index({ championship: 1, globalRoundIndex: 1 }, { unique: true });
|
|
31
|
+
exports.RoundModel = (0, mongoose_1.model)("round", RoundSchema);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Model, Types } from "mongoose";
|
|
2
|
+
import { Modality } from "../types/Modality";
|
|
3
|
+
export interface ITeam {
|
|
4
|
+
_id: Types.ObjectId;
|
|
5
|
+
name: string;
|
|
6
|
+
shortName?: string;
|
|
7
|
+
logoUrl?: string;
|
|
8
|
+
externalId?: string;
|
|
9
|
+
modality: Modality;
|
|
10
|
+
createdAtDateTime: Date;
|
|
11
|
+
updatedAtDateTime: Date;
|
|
12
|
+
}
|
|
13
|
+
export declare const TeamModel: Model<ITeam>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeamModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const Modality_1 = require("../types/Modality");
|
|
6
|
+
const TeamSchema = new mongoose_1.Schema({
|
|
7
|
+
name: { type: String, required: true },
|
|
8
|
+
shortName: { type: String, required: false },
|
|
9
|
+
logoUrl: { type: String, required: false },
|
|
10
|
+
externalId: { type: String, required: false },
|
|
11
|
+
modality: { type: String, required: true, enum: Modality_1.Modality }
|
|
12
|
+
}, {
|
|
13
|
+
timestamps: {
|
|
14
|
+
createdAt: "createdAtDateTime",
|
|
15
|
+
updatedAt: "updatedAtDateTime"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
TeamSchema.index({ name: 1, modality: 1 }, { unique: true });
|
|
19
|
+
TeamSchema.index({ externalId: 1 }, { unique: true, sparse: true });
|
|
20
|
+
exports.TeamModel = (0, mongoose_1.model)("team", TeamSchema);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ChallengeModel, type IChallenge } from "./Challenge";
|
|
2
|
+
export { ChallengeRoundModel } from "./ChallengeRound";
|
|
3
|
+
export { ChampionshipModel, type IChampionship } from "./Championship";
|
|
4
|
+
export { ChampionshipPhaseModel, type IChampionshipPhase, type IPhaseParticipant } from "./ChampionshipPhase";
|
|
5
|
+
export { ChampionshipRoundModel } from "./ChampionshipRound";
|
|
6
|
+
export { MatchModel, type IChampionshipMatch as IMatch } from "./ChampionshipMatch";
|
|
7
|
+
export { TeamModel, type ITeam } from "./Team";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeamModel = exports.MatchModel = exports.ChampionshipRoundModel = exports.ChampionshipPhaseModel = exports.ChampionshipModel = exports.ChallengeRoundModel = exports.ChallengeModel = void 0;
|
|
4
|
+
var Challenge_1 = require("./Challenge");
|
|
5
|
+
Object.defineProperty(exports, "ChallengeModel", { enumerable: true, get: function () { return Challenge_1.ChallengeModel; } });
|
|
6
|
+
var ChallengeRound_1 = require("./ChallengeRound");
|
|
7
|
+
Object.defineProperty(exports, "ChallengeRoundModel", { enumerable: true, get: function () { return ChallengeRound_1.ChallengeRoundModel; } });
|
|
8
|
+
var Championship_1 = require("./Championship");
|
|
9
|
+
Object.defineProperty(exports, "ChampionshipModel", { enumerable: true, get: function () { return Championship_1.ChampionshipModel; } });
|
|
10
|
+
var ChampionshipPhase_1 = require("./ChampionshipPhase");
|
|
11
|
+
Object.defineProperty(exports, "ChampionshipPhaseModel", { enumerable: true, get: function () { return ChampionshipPhase_1.ChampionshipPhaseModel; } });
|
|
12
|
+
var ChampionshipRound_1 = require("./ChampionshipRound");
|
|
13
|
+
Object.defineProperty(exports, "ChampionshipRoundModel", { enumerable: true, get: function () { return ChampionshipRound_1.ChampionshipRoundModel; } });
|
|
14
|
+
var ChampionshipMatch_1 = require("./ChampionshipMatch");
|
|
15
|
+
Object.defineProperty(exports, "MatchModel", { enumerable: true, get: function () { return ChampionshipMatch_1.MatchModel; } });
|
|
16
|
+
var Team_1 = require("./Team");
|
|
17
|
+
Object.defineProperty(exports, "TeamModel", { enumerable: true, get: function () { return Team_1.TeamModel; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modo de disputa dos grupos na fase.
|
|
3
|
+
* TODOS_SE_ENFRENTAM_NO_MESMO_GRUPO: os times do mesmo grupo se enfrentam.
|
|
4
|
+
* GRUPO_ENFRENTA_GRUPO: os times enfrentam times de grupos diferentes do seu.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum GroupMatchMode {
|
|
7
|
+
SAME_GROUP = "SAME_GROUP",
|
|
8
|
+
OTHER_GROUPS = "OTHER_GROUPS"
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupMatchMode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Modo de disputa dos grupos na fase.
|
|
6
|
+
* TODOS_SE_ENFRENTAM_NO_MESMO_GRUPO: os times do mesmo grupo se enfrentam.
|
|
7
|
+
* GRUPO_ENFRENTA_GRUPO: os times enfrentam times de grupos diferentes do seu.
|
|
8
|
+
*/
|
|
9
|
+
var GroupMatchMode;
|
|
10
|
+
(function (GroupMatchMode) {
|
|
11
|
+
GroupMatchMode["SAME_GROUP"] = "SAME_GROUP";
|
|
12
|
+
GroupMatchMode["OTHER_GROUPS"] = "OTHER_GROUPS";
|
|
13
|
+
})(GroupMatchMode || (exports.GroupMatchMode = GroupMatchMode = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Status do confronto (jogo).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MatchStatus = void 0;
|
|
7
|
+
var MatchStatus;
|
|
8
|
+
(function (MatchStatus) {
|
|
9
|
+
MatchStatus["PENDING"] = "PENDING";
|
|
10
|
+
MatchStatus["SCHEDULED"] = "SCHEDULED";
|
|
11
|
+
MatchStatus["IN_PLAY"] = "IN_PLAY";
|
|
12
|
+
MatchStatus["FINISHED"] = "FINISHED";
|
|
13
|
+
MatchStatus["POSTPONED"] = "POSTPONED";
|
|
14
|
+
MatchStatus["CANCELLED"] = "CANCELLED";
|
|
15
|
+
})(MatchStatus || (exports.MatchStatus = MatchStatus = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipo de modalidade
|
|
3
|
+
*/
|
|
4
|
+
export declare enum Modality {
|
|
5
|
+
SOCCER = "SOCCER",
|
|
6
|
+
BASKETBALL = "BASKETBALL",
|
|
7
|
+
TENNIS = "TENNIS",
|
|
8
|
+
VOLLEYBALL = "VOLLEYBALL",
|
|
9
|
+
HANDBALL = "HANDBALL",
|
|
10
|
+
GOLF = "GOLF",
|
|
11
|
+
BASEBALL = "BASEBALL",
|
|
12
|
+
HOCKEY = "HOCKEY",
|
|
13
|
+
AMERICAN_FOOTBALL = "AMERICAN_FOOTBALL",
|
|
14
|
+
RUGBY = "RUGBY"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tipo de modalidade
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Modality = void 0;
|
|
7
|
+
var Modality;
|
|
8
|
+
(function (Modality) {
|
|
9
|
+
Modality["SOCCER"] = "SOCCER";
|
|
10
|
+
Modality["BASKETBALL"] = "BASKETBALL";
|
|
11
|
+
Modality["TENNIS"] = "TENNIS";
|
|
12
|
+
Modality["VOLLEYBALL"] = "VOLLEYBALL";
|
|
13
|
+
Modality["HANDBALL"] = "HANDBALL";
|
|
14
|
+
Modality["GOLF"] = "GOLF";
|
|
15
|
+
Modality["BASEBALL"] = "BASEBALL";
|
|
16
|
+
Modality["HOCKEY"] = "HOCKEY";
|
|
17
|
+
Modality["AMERICAN_FOOTBALL"] = "AMERICAN_FOOTBALL";
|
|
18
|
+
Modality["RUGBY"] = "RUGBY";
|
|
19
|
+
})(Modality || (exports.Modality = Modality = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhaseType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tipo de disputa de uma fase do campeonato.
|
|
6
|
+
* Cada fase possui apenas um tipo.
|
|
7
|
+
*/
|
|
8
|
+
var PhaseType;
|
|
9
|
+
(function (PhaseType) {
|
|
10
|
+
PhaseType["PONTO_CORRIDO"] = "PONTO_CORRIDO";
|
|
11
|
+
PhaseType["MATA_MATA"] = "MATA_MATA";
|
|
12
|
+
})(PhaseType || (exports.PhaseType = PhaseType = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modo de classificação para a próxima fase (pode ser mais de um).
|
|
3
|
+
* OS_X_PRIMEIROS_DE_CADA_GRUPO: os X primeiros de cada grupo.
|
|
4
|
+
* OS_X_PRIMEIROS_GERAL: os X primeiros na classificação geral.
|
|
5
|
+
* OS_X_MELHORES_X_COLOCADO: os X melhores Yº colocados (ex.: melhores 3º colocados).
|
|
6
|
+
*/
|
|
7
|
+
export declare enum QualificationMode {
|
|
8
|
+
POSITION_INTO_GROUP = "POSITION_INTO_GROUP",
|
|
9
|
+
POSITION_GENERAL = "POSITION_GENERAL"
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QualificationMode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Modo de classificação para a próxima fase (pode ser mais de um).
|
|
6
|
+
* OS_X_PRIMEIROS_DE_CADA_GRUPO: os X primeiros de cada grupo.
|
|
7
|
+
* OS_X_PRIMEIROS_GERAL: os X primeiros na classificação geral.
|
|
8
|
+
* OS_X_MELHORES_X_COLOCADO: os X melhores Yº colocados (ex.: melhores 3º colocados).
|
|
9
|
+
*/
|
|
10
|
+
var QualificationMode;
|
|
11
|
+
(function (QualificationMode) {
|
|
12
|
+
QualificationMode["POSITION_INTO_GROUP"] = "POSITION_INTO_GROUP";
|
|
13
|
+
QualificationMode["POSITION_GENERAL"] = "POSITION_GENERAL";
|
|
14
|
+
})(QualificationMode || (exports.QualificationMode = QualificationMode = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoundStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Status da rodada no campeonato.
|
|
6
|
+
* CLOSED = rodada encerrada; Desafio não pode usar como rodada mínima uma rodada já CLOSED.
|
|
7
|
+
*/
|
|
8
|
+
var RoundStatus;
|
|
9
|
+
(function (RoundStatus) {
|
|
10
|
+
RoundStatus["PENDING"] = "PENDING";
|
|
11
|
+
RoundStatus["OPEN"] = "OPEN";
|
|
12
|
+
RoundStatus["CLOSED"] = "CLOSED";
|
|
13
|
+
})(RoundStatus || (exports.RoundStatus = RoundStatus = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { PhaseType } from "./PhaseType";
|
|
2
|
+
export { RoundStatus } from "./RoundStatus";
|
|
3
|
+
export { MatchStatus } from "./MatchStatus";
|
|
4
|
+
export { Modality } from "./Modality";
|
|
5
|
+
export { GroupMatchMode } from "./GroupMatchMode";
|
|
6
|
+
export { QualificationMode } from "./QualificationMode";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QualificationMode = exports.GroupMatchMode = exports.Modality = exports.MatchStatus = exports.RoundStatus = exports.PhaseType = void 0;
|
|
4
|
+
var PhaseType_1 = require("./PhaseType");
|
|
5
|
+
Object.defineProperty(exports, "PhaseType", { enumerable: true, get: function () { return PhaseType_1.PhaseType; } });
|
|
6
|
+
var RoundStatus_1 = require("./RoundStatus");
|
|
7
|
+
Object.defineProperty(exports, "RoundStatus", { enumerable: true, get: function () { return RoundStatus_1.RoundStatus; } });
|
|
8
|
+
var MatchStatus_1 = require("./MatchStatus");
|
|
9
|
+
Object.defineProperty(exports, "MatchStatus", { enumerable: true, get: function () { return MatchStatus_1.MatchStatus; } });
|
|
10
|
+
var Modality_1 = require("./Modality");
|
|
11
|
+
Object.defineProperty(exports, "Modality", { enumerable: true, get: function () { return Modality_1.Modality; } });
|
|
12
|
+
var GroupMatchMode_1 = require("./GroupMatchMode");
|
|
13
|
+
Object.defineProperty(exports, "GroupMatchMode", { enumerable: true, get: function () { return GroupMatchMode_1.GroupMatchMode; } });
|
|
14
|
+
var QualificationMode_1 = require("./QualificationMode");
|
|
15
|
+
Object.defineProperty(exports, "QualificationMode", { enumerable: true, get: function () { return QualificationMode_1.QualificationMode; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "c2-climbing-x",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Modelagem TypeScript/Mongoose para o jogo Escalada X (times, campeonatos, fases, rodadas, confrontos, desafios)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc --skipLibCheck",
|
|
9
|
+
"preversion": "tsc --skipLibCheck",
|
|
10
|
+
"postversion": "git push && git push --tags && npm publish",
|
|
11
|
+
"publish-patch": "npm version patch --force",
|
|
12
|
+
"publish-minor": "npm version minor",
|
|
13
|
+
"publish-major": "npm version major"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"mongoose": ">=9.0.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^20.12.11",
|
|
20
|
+
"mongoose": "^9.0.0",
|
|
21
|
+
"typescript": "^5.4.5"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"escalada-x",
|
|
28
|
+
"mongoose",
|
|
29
|
+
"championship",
|
|
30
|
+
"challenge"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|