feat: preserve normalized accepted game facts
This commit is contained in:
1 parent
e6e434d13f
commit
f3286e7fd1
4 files changed
+92
-32
No files matched your search
@@ -21,8 +21,7 @@ export const COMPETITION_OUTBOX_STATES = [
|
||||
'published',
|
||||
'failed',
|
||||
] as const;
|
||||
export type CompetitionOutboxState =
|
||||
(typeof COMPETITION_OUTBOX_STATES)[number];
|
||||
export type CompetitionOutboxState = (typeof COMPETITION_OUTBOX_STATES)[number];
|
||||
|
||||
export const TOURNAMENT_CODE_ASSIGNMENT_STATES = [
|
||||
'reserved',
|
||||
@@ -87,6 +86,9 @@ export interface CompetitionFact {
|
||||
seriesId?: mongoose.Types.ObjectId;
|
||||
gameSlotId?: mongoose.Types.ObjectId;
|
||||
ordinal?: number;
|
||||
startedAt?: Date;
|
||||
durationSeconds?: number;
|
||||
participants?: Array<Record<string, unknown>>;
|
||||
evidence?: Record<string, unknown>;
|
||||
mapping?: Record<string, unknown>;
|
||||
gameAcceptedFactId?: mongoose.Types.ObjectId;
|
||||
@@ -170,31 +172,31 @@ const CompetitionTeamSchema = new Schema<CompetitionTeamSnapshot>(
|
||||
|
||||
export const CompetitionSchema: mongoose.Schema<Competition> =
|
||||
new Schema<Competition>(
|
||||
{
|
||||
matchId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'match',
|
||||
required: true,
|
||||
{
|
||||
matchId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'match',
|
||||
required: true,
|
||||
},
|
||||
communityId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'community',
|
||||
required: true,
|
||||
},
|
||||
schemaVersion: { type: Number, required: true, min: 1 },
|
||||
projectorVersion: { type: Number, required: true, min: 1 },
|
||||
revision: { type: Number, required: true, min: 0, default: 0 },
|
||||
phase: {
|
||||
type: String,
|
||||
enum: COMPETITION_PHASES,
|
||||
required: true,
|
||||
default: 'ready',
|
||||
},
|
||||
teams: { type: [CompetitionTeamSchema], required: true },
|
||||
format: { type: Schema.Types.Mixed, required: true },
|
||||
seriesGraph: { type: Schema.Types.Mixed, required: true },
|
||||
projection: { type: Schema.Types.Mixed, required: true },
|
||||
},
|
||||
communityId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'community',
|
||||
required: true,
|
||||
},
|
||||
schemaVersion: { type: Number, required: true, min: 1 },
|
||||
projectorVersion: { type: Number, required: true, min: 1 },
|
||||
revision: { type: Number, required: true, min: 0, default: 0 },
|
||||
phase: {
|
||||
type: String,
|
||||
enum: COMPETITION_PHASES,
|
||||
required: true,
|
||||
default: 'ready',
|
||||
},
|
||||
teams: { type: [CompetitionTeamSchema], required: true },
|
||||
format: { type: Schema.Types.Mixed, required: true },
|
||||
seriesGraph: { type: Schema.Types.Mixed, required: true },
|
||||
projection: { type: Schema.Types.Mixed, required: true },
|
||||
},
|
||||
{ timestamps: true, collection: 'competition' },
|
||||
);
|
||||
|
||||
@@ -223,6 +225,9 @@ export const CompetitionFactSchema = new Schema<CompetitionFact>(
|
||||
seriesId: { type: Schema.Types.ObjectId },
|
||||
gameSlotId: { type: Schema.Types.ObjectId },
|
||||
ordinal: { type: Number, min: 1 },
|
||||
startedAt: { type: Date },
|
||||
durationSeconds: { type: Number, min: 0 },
|
||||
participants: { type: Schema.Types.Mixed },
|
||||
evidence: { type: Schema.Types.Mixed },
|
||||
mapping: { type: Schema.Types.Mixed },
|
||||
gameAcceptedFactId: { type: Schema.Types.ObjectId },
|
||||
|
||||
Reference in new issue
Block a user