Skip to content

Commit

Permalink
Merge pull request #841 from Sanofi-IADC/feature/WEB-2336
Browse files Browse the repository at this point in the history
feat: WEB-2336 added a new key to whisp data structure
  • Loading branch information
sairam459 authored Jun 25, 2024
2 parents e171b0f + ebfbc52 commit 725b276
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Whisp {
tags: [Tag!]
data: JSONObject
attachments: [WhispAttachment!]
dataIndexKey: String
}

"""
Expand Down Expand Up @@ -129,6 +130,7 @@ input WhispInputType {
applicationID: String
plantID: String
locationID: String
dataIndexKey: String
manual: Boolean
openedBy: String
openedById: String
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/whisp.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface IWhisp extends Document {
openedById: string;
closedBy: string;
closedById: string;
dataIndexKey: string;
timestamp: Date;
updated: Date;
expirationDate?: Date;
Expand Down
3 changes: 3 additions & 0 deletions src/whisp/whisp.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,7 @@ export class Whisp {

@Field(() => [WhispAttachment], { nullable: true })
attachments?: WhispAttachment[];

@Field({ nullable: true })
dataIndexKey?: string;
}
5 changes: 5 additions & 0 deletions src/whisp/whisp.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export class WhispInputType {
@IsOptional()
locationID?: string;

@Field(() => String, { nullable: true })
@IsString()
@IsOptional()
dataIndexKey?: string;

@Field(() => Boolean, { nullable: true })
@IsBoolean()
@IsOptional()
Expand Down
8 changes: 8 additions & 0 deletions src/whisp/whisp.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const whispSchema = new mongoose.Schema({
closedById: String,
timestamp: Date,
updated: Date,
dataIndexKey: String,
expirationDate: { type: Date, expires: 0 },
timeToLiveSec: Number,
data: Object,
Expand All @@ -35,4 +36,11 @@ whispSchema.index({
type: 1,
});

whispSchema.index({
dataIndexKey: 1,
applicationID: 1,
closed: 1,
type: 1,
});

mongoose.model('Whisp', whispSchema);

0 comments on commit 725b276

Please sign in to comment.