-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { WebSocketGateway, WebSocketServer } from '@nestjs/websockets' | ||
import { Server } from 'socket.io' | ||
|
||
@WebSocketGateway({ cors: true }) | ||
@WebSocketGateway({ | ||
cors: { | ||
origin: '*', | ||
}, | ||
}) | ||
export class AppGateway { | ||
@WebSocketServer() server: Server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Jukebox Types | ||
|
||
## Interface Standards | ||
|
||
All models have the following fields: | ||
|
||
```ts | ||
// Default fields for all models | ||
interface IModel { | ||
id: string | ||
created_at: string | ||
updated_at: string | ||
} | ||
``` | ||
|
||
For a model `Example`, the following types would be: | ||
|
||
```ts | ||
// Base object, has all fields from database | ||
interface IExample extends IModel {} | ||
// Fields used to create object | ||
interface IExampleCreate extends ICreate<IExample> {} | ||
// Fields used to update object | ||
interface IExampleUpdate extends IUpdate<IExample> {} | ||
|
||
/** Optional Interfaces */ | ||
// Aggregate related data for object | ||
interface IExampleDetails extends IExample {} | ||
``` | ||
|
||
## Conventions | ||
|
||
For a model `Example`, abide by the following: | ||
|
||
- Objects generated from ORMs or Schemas would be called `Example` | ||
- Interfaces called `IExample` | ||
- All fields in object are snake case, regardless of the tech stack used. This should be especially enforced in REST APIs. |