Skip to content

Commit

Permalink
refactor: updated types for mongoose models
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed Jul 17, 2024
1 parent 0b53393 commit b241a12
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/common/mongoose/paginate.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface PagingResults<DocType> {
pageSize: number;
totalPages: number;
totalSize: number;
elements: HydratedDocument<DocType>[];
elements: DocType[];
}

export interface Paginateable<DocType> {
Expand Down
3 changes: 2 additions & 1 deletion src/app/core/access-checker/cache/cache-entry.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export interface ICacheEntryMethods {

export type CacheEntryDocument = HydratedDocument<
ICacheEntry,
ICacheEntryMethods
ICacheEntryMethods,
ICacheEntryQueryHelpers
>;

type ICacheEntryQueryHelpers = ContainsSearchable &
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/audit/audit.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ interface IAudit {
};
}

export type AuditDocument = HydratedDocument<IAudit>;
export type AuditDocument = HydratedDocument<
IAudit,
NonNullable<unknown>,
IAuditQueryHelpers
>;

type IAuditQueryHelpers = ContainsSearchable & Paginateable<AuditDocument>;

Expand Down
6 changes: 5 additions & 1 deletion src/app/core/feedback/feedback.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export interface IFeedback {
updated: Date;
}

export type FeedbackDocument = HydratedDocument<IFeedback>;
export type FeedbackDocument = HydratedDocument<
IFeedback,
NonNullable<unknown>,
IFeedbackQueryHelpers
>;

type IFeedbackQueryHelpers = TextSearchable & Paginateable<FeedbackDocument>;

Expand Down
3 changes: 2 additions & 1 deletion src/app/core/messages/dismissed-message.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export interface IDismissedMessageMethods {

export type DismissedMessageDocument = HydratedDocument<
IDismissedMessage,
IDismissedMessageMethods
IDismissedMessageMethods,
IDismissedMessageQueryHelpers
>;

type IDismissedMessageQueryHelpers = TextSearchable &
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/messages/message.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export interface IMessageMethods {
fullCopy(): Record<string, unknown>;
}

export type MessageDocument = HydratedDocument<IMessage, IMessageMethods>;
export type MessageDocument = HydratedDocument<
IMessage,
IMessageMethods,
IMessageQueryHelpers
>;

type IMessageQueryHelpers = TextSearchable & Paginateable<MessageDocument>;

Expand Down
3 changes: 2 additions & 1 deletion src/app/core/notifications/notification.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export interface INotificationMethods {

export type NotificationDocument = HydratedDocument<
INotification,
INotificationMethods
INotificationMethods,
INotificationQueryHelpers
>;

type INotificationQueryHelpers = Paginateable<NotificationDocument>;
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/teams/team.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export interface ITeamMethods {
auditCopyTeamMember(user: UserDocument): Record<string, unknown>;
}

export type TeamDocument = HydratedDocument<ITeam, ITeamMethods>;
export type TeamDocument = HydratedDocument<
ITeam,
ITeamMethods,
ITeamQueryHelpers
>;

type ITeamQueryHelpers = ContainsSearchable & Paginateable<TeamDocument>;

Expand Down

0 comments on commit b241a12

Please sign in to comment.