Skip to content

Commit

Permalink
training event types #1
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeenciu committed Jul 8, 2023
1 parent d2cc933 commit eab8f84
Show file tree
Hide file tree
Showing 29 changed files with 623 additions and 0 deletions.
18 changes: 18 additions & 0 deletions libs/training-events-types/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
11 changes: 11 additions & 0 deletions libs/training-events-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# training-events-types

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build training-events-types` to build the library.

## Running unit tests

Run `nx test training-events-types` to execute the unit tests via [Jest](https://jestjs.io).
5 changes: 5 additions & 0 deletions libs/training-events-types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@rovacc/training-events-types",
"version": "0.0.1",
"type": "commonjs"
}
31 changes: 31 additions & 0 deletions libs/training-events-types/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "training-events-types",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/training-events-types/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/training-events-types"
}
},
"test": {
"executor": "@nx/vite:test",
"outputs": ["coverage/libs/training-events-types"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/libs/training-events-types"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/training-events-types/**/*.ts"]
}
}
},
"tags": []
}
18 changes: 18 additions & 0 deletions libs/training-events-types/src/events/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export { TrainingCompletedEvent, TrainingCompletedEventData } from "./training-completed"
export { TrainingCptPerformedEvent, TrainingCptPerformedEventData } from "./training-cpt-performed"
export { TrainingCptRequestedEvent, TrainingCptRequestedEventData } from "./training-cpt-requested"
export { TrainingCptScheduledEvent, TrainingCptScheduledEventData } from "./training-cpt-scheduled"
export { TrainingIntentConfirmationExpiredEvent, TrainingIntentConfirmationExpiredEventData } from "./training-intent-confirmation-expired"
export { TrainingIntentConfirmationRejectedEvent, TrainingIntentConfirmationRejectedEventData } from "./training-intent-confirmation-rejected"
export { TrainingIntentConfirmationRequestedEvent, TrainingIntentConfirmationRequestedEventData } from "./training-intent-confirmation-requested"
export { TrainingIntentConfirmationRespondedEvent, TrainingIntentConfirmationRespondedEventData } from "./training-intent-confirmation-responded"
export { TrainingIntentEvent, TrainingIntentEventData } from "./training-intent"
export { TrainingMentorAssignedEvent, TrainingMentorAssignedEventData } from "./training-mentor-assigned"
export { TrainingMentorReassignedEvent, TrainingMentorReassignedEventData } from "./training-mentor-reassigned"
export { TrainingSessionPerformedEvent, TrainingSessionPerformedEventData } from "./training-session-performed"
export { TrainingSessionScheduledEvent, TrainingSessionScheduledEventData } from "./training-session-scheduled"
export { TrainingSoloPerformedEvent, TrainingSoloPerformedEventData } from "./training-solo-performed"
export { TrainingSoloRequestedEvent, TrainingSoloRequestedEventData } from "./training-solo-requested"
export { TrainingSoloScheduledEvent, TrainingSoloScheduledEventData } from "./training-solo-scheduled"
export { TrainingTestAssignedEvent, TrainingTestAssignedEventData } from "./training-test-assigned"
export { TrainingTestCompletedEvent, TrainingTestCompletedEventData } from "./training-test-completed"
16 changes: 16 additions & 0 deletions libs/training-events-types/src/events/training-completed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

import { OutcomeReason, OutcomeReasonDetailed, TrainingEventMetadata } from "../types";

const name = 'training-completed'

export type TrainingCompletedEventData = {
trainingId: string,
name: typeof name
payload: {
reason: OutcomeReason
reasonDetailed: OutcomeReasonDetailed
}
}

export type TrainingCompletedEvent = TrainingEventMetadata & TrainingCompletedEventData

17 changes: 17 additions & 0 deletions libs/training-events-types/src/events/training-cpt-performed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import { Member, TrainingEventMetadata, TrainingReport } from "../types";

const name = 'training-cpt-performed'

export type TrainingCptPerformedEventData = {
trainingId: string,
name: typeof name
payload: {
assessedBy: Member
report: TrainingReport
passed: boolean
}
}

export type TrainingCptPerformedEvent = TrainingEventMetadata & TrainingCptPerformedEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-cpt-requested.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { Member, TrainingEventMetadata } from "../types";

const name = 'training-cpt-requested'

export type TrainingCptRequestedEventData = {
trainingId: string,
name: typeof name
payload: {
requestedBy: Member
}
}

export type TrainingCptRequestedEvent = TrainingEventMetadata & TrainingCptRequestedEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-cpt-scheduled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { TrainingEventMetadata } from "../types";

const name = 'training-cpt-scheduled'

export type TrainingCptScheduledEventData = {
trainingId: string,
name: typeof name
payload: {
scheduledAt: Date
}
}

export type TrainingCptScheduledEvent = TrainingEventMetadata & TrainingCptScheduledEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import { TrainingEventMetadata } from "../types";

const name = 'training-intent-confirmation-expired';

export type TrainingIntentConfirmationExpiredEventData = {
name: typeof name
trainingId: string
payload: Record<string, never>
}

export type TrainingIntentConfirmationExpiredEvent = TrainingEventMetadata & TrainingIntentConfirmationExpiredEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { TrainingEventMetadata } from "../types";

const name = 'training-intent-confirmation-rejected';

export type TrainingIntentConfirmationRejectedEventData = {
name: typeof name
trainingId: string
payload: Record<string, never>
}

export type TrainingIntentConfirmationRejectedEvent = TrainingEventMetadata & TrainingIntentConfirmationRejectedEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import { TrainingEventMetadata } from "../types";

const name = 'training-intent-confirmation-requested';

export type TrainingIntentConfirmationRequestedEventData = {
name: typeof name
trainingId: string
payload: Record<string, never>
}

export type TrainingIntentConfirmationRequestedEvent = TrainingEventMetadata & TrainingIntentConfirmationRequestedEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

import { TrainingEventMetadata } from "../types";

const name = 'training-intent-confirmation-responded';

export type TrainingIntentConfirmationRespondedEventData = {
name: typeof name
trainingId: string
payload: Record<string, never>
}

export type TrainingIntentConfirmationRespondedEvent = TrainingEventMetadata & TrainingIntentConfirmationRespondedEventData

17 changes: 17 additions & 0 deletions libs/training-events-types/src/events/training-intent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import { TrainingEventMetadata, TrainingPurpose } from "../types";

const name = 'training-intent';

export type TrainingIntentEventData = {
trainingId: string,
name: typeof name
payload: {
student: number
rating: number
purpose: TrainingPurpose
}
}

export type TrainingIntentEvent = TrainingEventMetadata & TrainingIntentEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-mentor-assigned.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Member, TrainingEventMetadata } from "../types";

const name = 'training-mentor-assigned'

export type TrainingMentorAssignedEventData = {
name: typeof name
trainingId: string
payload: {
mentor: Member
assignedBy: Member
}
}

export type TrainingMentorAssignedEvent = TrainingEventMetadata & TrainingMentorAssignedEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Member, TrainingEventMetadata } from "../types";

const name = 'training-mentor-reassigned'

export type TrainingMentorReassignedEventData = {
name: typeof name
trainingId: string
payload: {
mentor: Member
assignedBy: Member
}
}

export type TrainingMentorReassignedEvent = TrainingEventMetadata & TrainingMentorReassignedEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Member, TrainingEventMetadata, TrainingReport } from "../types";

const name = 'training-session-performed'

export type TrainingSessionPerformedEventData = {
name: typeof name
trainingId: string
payload: {
sessionId: string
mentor: Member,
report: TrainingReport
}
}

export type TrainingSessionPerformedEvent = TrainingEventMetadata & TrainingSessionPerformedEventData

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TrainingEventMetadata } from "../types";

const name = 'training-session-scheduled'

export type TrainingSessionScheduledEventData = {
name: typeof name
trainingId: string
payload: {
sessionId: string
scheduledAt: Date
}
}

export type TrainingSessionScheduledEvent = TrainingEventMetadata & TrainingSessionScheduledEventData

17 changes: 17 additions & 0 deletions libs/training-events-types/src/events/training-solo-performed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import { Member, TrainingEventMetadata, TrainingReport } from "../types";

const name = 'training-solo-performed'

export type TrainingSoloPerformedEventData = {
trainingId: string,
name: typeof name
payload: {
requestedBy: Member
passed: boolean
report: TrainingReport
}
}

export type TrainingSoloPerformedEvent = TrainingEventMetadata & TrainingSoloPerformedEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-solo-requested.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { Member, TrainingEventMetadata } from "../types";

const name = 'training-solo-requested'

export type TrainingSoloRequestedEventData = {
trainingId: string,
name: typeof name
payload: {
requestedBy: Member
}
}

export type TrainingSoloRequestedEvent = TrainingEventMetadata & TrainingSoloRequestedEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-solo-scheduled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { TrainingEventMetadata } from "../types";

const name = 'training-solo-scheduled'

export type TrainingSoloScheduledEventData = {
trainingId: string,
name: typeof name
payload: {
scheduledAt: Date
}
}

export type TrainingSoloScheduledEvent = TrainingEventMetadata & TrainingSoloScheduledEventData

15 changes: 15 additions & 0 deletions libs/training-events-types/src/events/training-test-assigned.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import { Member, TrainingEventMetadata } from "../types";

const name = 'training-test-assigned'

export type TrainingTestAssignedEventData = {
trainingId: string,
name: typeof name
payload: {
assignedBy: Member
}
}

export type TrainingTestAssignedEvent = TrainingEventMetadata & TrainingTestAssignedEventData

16 changes: 16 additions & 0 deletions libs/training-events-types/src/events/training-test-completed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestResult, TrainingEventMetadata } from "../types";

const name = 'training-test-completed'

export type TrainingTestCompletedEventData = {
trainingId: string,
name: typeof name
payload: {
passed: boolean
result: TestResult
willExpireAt?: Date
}
}

export type TrainingTestCompletedEvent = TrainingEventMetadata & TrainingTestCompletedEventData

2 changes: 2 additions & 0 deletions libs/training-events-types/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './types'
export * from './events'
Loading

0 comments on commit eab8f84

Please sign in to comment.