Bingo for meetings–obsolete–re-reading requirements- part 7


Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at . Those are my blog posts for Bingo : ( scroll below for the post)
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
21Deploy Angular to GitHub
22WebAPI and Web
24Documentation of the code

Last time we have to implement the requirement:

Meeting Obsolete:
The meeting is available for 35 minutes. After that, meeting is not available anymore.

We did so for the 35 minutes. But we did not for the last sentence – meeting is not available anymore. There are 2 points here: of design ( do not retrieve meeting ) and enforcing that no participant can write to the meeting.

So we modify the functions   AddParticipant, CheckCardByParticipant  to raise an exception if the meeting is obsolete .( As a side effect of identifying the functions that make actions in the opposite of functions that just reports, I think about structuring code in CQRS form )

Now for TypeScript we have 2 options :

  1. Construct a class that inherits from Error
  2. Modify the response type of those function to a combined type of result and error

For the first one , we should take care of TypeScript syntax of creating errors: See  and

class CustomError extends Error {

constructor(message?: string) {


// ‘Error’ breaks prototype chain here

Object.setPrototypeOf(this,; // restore prototype chain



For the second , we could do ourselves or use a npm package such as

I decide to go to the second. I have too many times use the first thing in C# – it is time to have something new. Anyway, this is the code now

    import { ok, err, Result } from 'neverthrow';
    public CheckCardByParticipant(c: Cards , p:Participant): Result<Meeting,Error>{
        //TODO: verify participant is added first or add
        //TODO: verify card is added first
            return err(new Error(`cannot check card to the obsolete meeting ${this.Id}`));
        return ok(this);
    public AddParticipant(p:Participant ): Result<number,Error>{
            return err(new Error(`cannot add participant to the obsolete meeting ${this.Id}`));

        return ok(this.Participants.length);

and those are the tests

        const mf=new MeetingsFactory();

        const m1=mf.CreateMeeting("andrei","first meeting");
        const now =;
        const spy = jest.spyOn(Date,'now');
          console.log('calling DateTime Now');
          return now + 36 * 60* 1000;
        } );
        const p=new Participant();
        p.Name ="alexandru";
        const res= m1.AddParticipant(p);