-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate connection model from signature
- Loading branch information
Showing
10 changed files
with
77 additions
and
135 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
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,55 @@ | ||
import { Field, ObjectType, registerEnumType } from "@nestjs/graphql"; | ||
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; | ||
import mongoose, { Document } from "mongoose"; | ||
import MassStatus from "./mass-status.enum"; | ||
|
||
registerEnumType(MassStatus, { name: "MassStatus" }); | ||
|
||
@ObjectType() | ||
@Schema() | ||
export class Connection { | ||
@Field() | ||
id: string; | ||
|
||
@Field() | ||
@Prop({ index: true }) | ||
from: string; | ||
|
||
@Field({ nullable: true }) | ||
@Prop() | ||
to: string; | ||
|
||
/** | ||
* Connection's inherent type. | ||
* | ||
* Defined as the type of the "named-side" wormhole (e.g. H296) regardless of | ||
* the actual direction, i.e., this type can never be K162. | ||
*/ | ||
@Field({ nullable: true }) | ||
@Prop() | ||
type: string; | ||
|
||
@Field() | ||
@Prop() | ||
k162: boolean; | ||
|
||
@Field() | ||
@Prop() | ||
eol: boolean; | ||
|
||
@Field((type) => Date, { nullable: true }) | ||
@Prop() | ||
eolAt?: Date; | ||
|
||
@Field((type) => MassStatus) | ||
@Prop() | ||
massStatus: MassStatus; | ||
|
||
@Field((type) => Connection) | ||
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: Connection.name }) | ||
reverse: Connection; | ||
} | ||
|
||
export type ConnectionDocument = Connection & Document; | ||
|
||
export const ConnectionSchema = SchemaFactory.createForClass(Connection); |
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,13 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { MongooseModule } from "@nestjs/mongoose"; | ||
import { Connection, ConnectionSchema } from "./connection.model"; | ||
|
||
@Module({ | ||
imports: [ | ||
MongooseModule.forFeature([ | ||
{ name: Connection.name, schema: ConnectionSchema }, | ||
]), | ||
], | ||
exports: [MongooseModule], | ||
}) | ||
export class ConnectionModule {} |
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.