Skip to content

201 extend mongolib#202

Merged
Behzad-rabiei merged 2 commits intomainfrom
201-extend-mongolib
May 6, 2025
Merged

201 extend mongolib#202
Behzad-rabiei merged 2 commits intomainfrom
201-extend-mongolib

Conversation

@Behzad-rabiei
Copy link
Member

@Behzad-rabiei Behzad-rabiei commented May 6, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a generic repository system, providing dedicated repositories for users, tokens, heat maps, raw information, member activities, guild members, channels, roles, communities, platforms, announcements, and modules.
    • Added a consolidated module to access all repositories from a single entry point.
  • Refactor

    • Updated the main entry point to export new repository and database management modules, while removing the previous service export.
    • Improved import organization and formatting for clarity and consistency.
  • Chores

    • Removed an outdated changelog entry.
    • Adjusted README formatting for improved readability.

@coderabbitai
Copy link

coderabbitai bot commented May 6, 2025

Walkthrough

This update introduces a generic repository pattern for Mongoose models, adding a BaseRepository class and specific repositories for various data models. The repositories are consolidated into a new index module for unified access. The entry point now exports these repositories and database management modules. Minor formatting and documentation changes were also made.

Changes

File(s) Change Summary
CHANGELOG.md Removed the changelog entry for version 3.5.0, including its header, date, and feature description.
README.md Adjusted blank lines for improved spacing consistency; no content changes.
src/connection.ts Changed import of Connection from type-only to regular import; removed JSDoc comment; minor formatting fix in a comment.
src/databaseManager.ts Reorganized and reordered import statements for logical grouping; no logic changes.
src/index.ts Removed export of ./service; added exports for ./databaseManager, ./connection, and ./repositories.
src/service/index.ts Deleted the file; previously re-exported DatabaseManager and Connection.
src/repositories/base.repository.ts Added BaseRepository<T> generic class with standard CRUD and pagination methods; introduced PaginateOptions interface.
src/repositories/index.ts New module aggregating and re-exporting all repository instances and the base repository class.
src/repositories/announcement.repository.ts
src/repositories/channel.repository.ts
src/repositories/community.repository.ts
src/repositories/guildMember.repository.ts
src/repositories/heatMap.repository.ts
src/repositories/memberActivity.repository.ts
src/repositories/module.repository.ts
src/repositories/platform.repository.ts
src/repositories/rawInfo.repository.ts
src/repositories/role.repository.ts
src/repositories/token.repository.ts
src/repositories/user.repository.ts
Added repository classes for each data model, each extending BaseRepository with the respective type; each exports a singleton instance as default and named export.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant Repository
    participant MongooseModel

    App->>Repository: Call CRUD or paginate method
    Repository->>MongooseModel: Execute DB operation (create, find, update, delete, paginate)
    MongooseModel-->>Repository: Return result
    Repository-->>App: Return result
Loading

Poem

A warren of repositories, new and neat,
Each model now has its own seat.
The base class brings order, CRUD in a row,
Aggregated exports let dependencies flow.
With imports tidied and spacing just right,
The code hops forward, swift and light!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Behzad-rabiei Behzad-rabiei merged commit 2ee98db into main May 6, 2025
3 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (21)
src/connection.ts (2)

1-1: Fix type import for Connection

The Connection import should use a type-only import as flagged by ESLint since it's only used as a type.

-import mongoose, { Connection } from 'mongoose';
+import mongoose, { type Connection } from 'mongoose';
🧰 Tools
🪛 ESLint

[error] 1-1: Import "Connection" is only used as types.

(@typescript-eslint/consistent-type-imports)


7-7: Fix typo in comment

There's a missing space between "constructor" and "to".

-  // Private constructorto prevent direct instantiation
+  // Private constructor to prevent direct instantiation
src/databaseManager.ts (1)

1-4: Fix type imports

ESLint flags that these imports are only used as types and should use the type keyword.

-import { Snowflake } from 'discord.js';
-import mongoose, { Connection } from 'mongoose';
+import type { Snowflake } from 'discord.js';
+import mongoose, { type Connection } from 'mongoose';

-import { IChannel, IGuildMember, IHeatMap, IMemberActivity, IRawInfo, IRole } from './interfaces';
+import type { IChannel, IGuildMember, IHeatMap, IMemberActivity, IRawInfo, IRole } from './interfaces';
🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 2-2: Import "Connection" is only used as types.

(@typescript-eslint/consistent-type-imports)


[error] 4-4: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/heatMap.repository.ts (1)

1-4: Use import type for type-only imports

The Model from 'mongoose' and IHeatMap from '../interfaces' are only used as types in this file. Follow TypeScript best practices by using the import type syntax for these imports:

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
import { BaseRepository } from './base.repository';
-import { IHeatMap } from '../interfaces';
+import type { IHeatMap } from '../interfaces';
import HeatMap from '../models/HeatMap.model';

This helps with tree-shaking and makes the distinction between runtime dependencies and type dependencies clearer.

🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/role.repository.ts (1)

1-4: Use import type for type-only imports

The Model from 'mongoose' and IRole from '../interfaces' are only used as types in this file. Follow TypeScript best practices by using the import type syntax for these imports:

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
import { BaseRepository } from './base.repository';
-import { IRole } from '../interfaces';
+import type { IRole } from '../interfaces';
import Role from '../models/Role.model';

This follows TypeScript best practices and satisfies the ESLint rule requirements.

🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/user.repository.ts (1)

1-4: Use import type for type-only imports

The Model from 'mongoose' and IUser from '../interfaces' are only used as types in this file. Follow TypeScript best practices by using the import type syntax for these imports:

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
import { BaseRepository } from './base.repository';
-import { IUser } from '../interfaces';
+import type { IUser } from '../interfaces';
import User from '../models/User.model';

This change will satisfy the ESLint rules and maintain consistency throughout the codebase.

🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/rawInfo.repository.ts (1)

1-3: Use import type for type-only imports

The Model from mongoose and IRawInfo are only used as types in this file. Consider using import type syntax to improve tree-shaking and compilation output.

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
 import { BaseRepository } from './base.repository';
-import { IRawInfo } from '../interfaces';
+import type { IRawInfo } from '../interfaces';
 import RawInfo from '../models/RawInfo.model';
🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/guildMember.repository.ts (1)

1-3: Use import type for type-only imports

The Model from mongoose and IGuildMember are only used as types in this file. Consider using import type syntax to improve tree-shaking and compilation output.

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
 import { BaseRepository } from './base.repository';
-import { IGuildMember } from '../interfaces';
+import type { IGuildMember } from '../interfaces';
 import GuildMember from '../models/GuildMember.model';
🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/announcement.repository.ts (1)

1-3: Use import type for type-only imports

The Model from mongoose and IAnnouncement are only used as types in this file. Consider using import type syntax to improve tree-shaking and compilation output.

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
 import { BaseRepository } from './base.repository';
-import { IAnnouncement } from '../interfaces';
+import type { IAnnouncement } from '../interfaces';
 import Announcement from '../models/Announcement.model';
🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/base.repository.ts (9)

1-1: Update the file comment path to match actual path.

The file comment indicates src/db/repositories/base.repository.ts but the actual file path is src/repositories/base.repository.ts.

-// src/db/repositories/base.repository.ts
+// src/repositories/base.repository.ts

2-2: Use import type for type-only imports.

As indicated by the static analysis tool, consider using import type for type-only imports to improve bundle size and follow TypeScript best practices.

-import { FilterQuery, LeanDocument, Model, PopulateOptions, ProjectionType, QueryOptions, UpdateQuery } from 'mongoose';
+import type { FilterQuery, LeanDocument, Model, PopulateOptions, ProjectionType, QueryOptions, UpdateQuery } from 'mongoose';
🧰 Tools
🪛 ESLint

[error] 2-2: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


14-16: Remove redundant await with return.

When returning a Promise directly, the await keyword is redundant since the calling function is already async.

-  async create(doc: Partial<T>): Promise<T> {
-    return await this.model.create(doc);
+  async create(doc: Partial<T>): Promise<T> {
+    return this.model.create(doc);

18-20: Remove redundant await with return.

Same issue as in the create method. The await is unnecessary when directly returning a Promise.

-  async createMany(docs: Array<Partial<T>>): Promise<T[]> {
-    return await this.model.insertMany(docs);
+  async createMany(docs: Array<Partial<T>>): Promise<T[]> {
+    return this.model.insertMany(docs);

22-24: Remove redundant await with return.

Same issue as in previous methods.

-  async findById(id: string, projection?: ProjectionType<T>, options?: QueryOptions): Promise<T | null> {
-    return await this.model.findById(id, projection, options);
+  async findById(id: string, projection?: ProjectionType<T>, options?: QueryOptions): Promise<T | null> {
+    return this.model.findById(id, projection, options);

26-28: Remove redundant await with return.

Same issue as in previous methods.

-  async find(filter: FilterQuery<T>, projection?: ProjectionType<T>, options?: QueryOptions): Promise<T[]> {
-    return await this.model.find(filter, projection, options);
+  async find(filter: FilterQuery<T>, projection?: ProjectionType<T>, options?: QueryOptions): Promise<T[]> {
+    return this.model.find(filter, projection, options);

30-36: Remove redundant await with return.

Same issue as in previous methods.

-  async updateOne(
-    filter: FilterQuery<T>,
-    update: UpdateQuery<T>,
-    options?: QueryOptions,
-  ): Promise<{ acknowledged: boolean; modifiedCount: number; upsertedId: unknown }> {
-    return await this.model.updateOne(filter, update, options);
+  async updateOne(
+    filter: FilterQuery<T>,
+    update: UpdateQuery<T>,
+    options?: QueryOptions,
+  ): Promise<{ acknowledged: boolean; modifiedCount: number; upsertedId: unknown }> {
+    return this.model.updateOne(filter, update, options);

38-40: Remove redundant await with return.

Same issue as in previous methods.

-  async deleteOne(filter: FilterQuery<T>): Promise<{ deletedCount?: number }> {
-    return await this.model.deleteOne(filter);
+  async deleteOne(filter: FilterQuery<T>): Promise<{ deletedCount?: number }> {
+    return this.model.deleteOne(filter);

42-44: Remove redundant await with return.

Same issue as in previous methods.

-  async deleteMany(filter: FilterQuery<T>): Promise<{ deletedCount?: number }> {
-    return await this.model.deleteMany(filter);
+  async deleteMany(filter: FilterQuery<T>): Promise<{ deletedCount?: number }> {
+    return this.model.deleteMany(filter);
src/repositories/memberActivity.repository.ts (3)

1-1: Use import type for type-only imports.

Model is only used as a type in the constructor parameter, not as a value.

-import { Model } from 'mongoose';
+import type { Model } from 'mongoose';
🧰 Tools
🪛 ESLint

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


3-3: Use import type for interface imports.

IMemberActivity is only used as a type, not as a value.

-import { IMemberActivity } from '../interfaces';
+import type { IMemberActivity } from '../interfaces';
🧰 Tools
🪛 ESLint

[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


6-10: Add documentation to the repository class.

The repository class lacks any documentation explaining its purpose or any specific methods it might offer beyond those inherited from BaseRepository.

+/**
+ * Repository for managing member activity data.
+ * Extends the base repository with IMemberActivity type.
+ */
 export class MemberActivityRepository extends BaseRepository<IMemberActivity> {
   constructor(model: Model<IMemberActivity> = MemberActivity) {
     super(model);
   }
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb83617 and cfcd79d.

📒 Files selected for processing (20)
  • CHANGELOG.md (0 hunks)
  • README.md (2 hunks)
  • src/connection.ts (1 hunks)
  • src/databaseManager.ts (1 hunks)
  • src/index.ts (1 hunks)
  • src/repositories/announcement.repository.ts (1 hunks)
  • src/repositories/base.repository.ts (1 hunks)
  • src/repositories/channel.repository.ts (1 hunks)
  • src/repositories/community.repository.ts (1 hunks)
  • src/repositories/guildMember.repository.ts (1 hunks)
  • src/repositories/heatMap.repository.ts (1 hunks)
  • src/repositories/index.ts (1 hunks)
  • src/repositories/memberActivity.repository.ts (1 hunks)
  • src/repositories/module.repository.ts (1 hunks)
  • src/repositories/platform.repository.ts (1 hunks)
  • src/repositories/rawInfo.repository.ts (1 hunks)
  • src/repositories/role.repository.ts (1 hunks)
  • src/repositories/token.repository.ts (1 hunks)
  • src/repositories/user.repository.ts (1 hunks)
  • src/service/index.ts (0 hunks)
💤 Files with no reviewable changes (2)
  • CHANGELOG.md
  • src/service/index.ts
🧰 Additional context used
🧬 Code Graph Analysis (10)
src/repositories/platform.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • platformRepository (26-26)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Platfrom.interface.ts (1)
  • IPlatform (4-10)
src/models/index.ts (1)
  • Platform (23-23)
src/repositories/announcement.repository.ts (2)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Announcement.interface.ts (1)
  • IAnnouncement (18-31)
src/repositories/community.repository.ts (2)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Community.interface.ts (1)
  • ICommunity (14-21)
src/repositories/token.repository.ts (2)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Token.interface.ts (1)
  • IToken (4-11)
src/repositories/module.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • moduleRepository (28-28)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Module.interface.ts (1)
  • IModule (5-16)
src/models/index.ts (1)
  • Module (25-25)
src/repositories/channel.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • channelRepository (23-23)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Channel.interface.ts (1)
  • IChannel (11-18)
src/models/index.ts (1)
  • Channel (20-20)
src/repositories/user.repository.ts (2)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/User.interface.ts (1)
  • IUser (9-13)
src/repositories/memberActivity.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • memberActivityRepository (21-21)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/MemberActivity.interface.ts (1)
  • IMemberActivity (3-25)
src/models/index.ts (1)
  • MemberActivity (18-18)
src/repositories/role.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • roleRepository (24-24)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/Role.interface.ts (1)
  • IRole (4-9)
src/models/index.ts (1)
  • Role (21-21)
src/repositories/rawInfo.repository.ts (4)
src/repositories/index.ts (2)
  • BaseRepository (16-16)
  • rawInfoRepository (20-20)
src/repositories/base.repository.ts (1)
  • BaseRepository (11-58)
src/interfaces/RawInfo.interface.ts (1)
  • IRawInfo (4-19)
src/models/index.ts (1)
  • RawInfo (17-17)
🪛 ESLint
src/repositories/platform.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/connection.ts

[error] 1-1: Import "Connection" is only used as types.

(@typescript-eslint/consistent-type-imports)

src/repositories/announcement.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/community.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/token.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/module.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/channel.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/user.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/databaseManager.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 2-2: Import "Connection" is only used as types.

(@typescript-eslint/consistent-type-imports)


[error] 4-4: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/guildMember.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/heatMap.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/memberActivity.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/base.repository.ts

[error] 2-2: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/role.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

src/repositories/rawInfo.repository.ts

[error] 1-1: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)


[error] 3-3: All imports in the declaration are only used as types. Use import type.

(@typescript-eslint/consistent-type-imports)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci / build-push / Build + Push Image
🔇 Additional comments (25)
README.md (1)

88-88: Appropriate spacing addition

This blank line addition improves readability by properly separating the Module interface section from the Heatmap interface section.

src/index.ts (1)

5-7: Good organization of exports

The new exports provide direct access to database functionality and the newly introduced repositories. This is a good architectural change that aligns with the repository pattern being introduced.

src/databaseManager.ts (1)

5-12: Well-organized schema imports

The reordering of schema imports improves code organization by grouping related schemas together, which is a good practice.

src/repositories/token.repository.ts (2)

6-10: Looks good - clean implementation of repository pattern

The TokenRepository class properly extends the BaseRepository with the correct interface type, and allows for dependency injection of a different model if needed. This follows good software design principles.


12-13: Good approach providing both named and default exports

Exporting both the instance and the default provides flexibility for consumers of this module.

src/repositories/module.repository.ts (2)

6-10: Implementation follows the repository pattern correctly

The ModuleRepository class correctly extends BaseRepository with the IModule interface type, and the dependency injection pattern is implemented properly.


12-13: Consistent export pattern

The export pattern is consistent with other repository classes, providing both a named singleton export and a default export.

src/repositories/community.repository.ts (2)

6-10: Clean implementation of the repository pattern

The CommunityRepository implementation follows the same clean pattern as the other repositories, correctly extending BaseRepository with the proper interface type.


12-13: Export pattern is consistent

The exports follow the same pattern as other repository modules, which is good for maintaining consistency across the codebase.

src/repositories/channel.repository.ts (2)

6-10: Implementation aligns with repository design pattern

The ChannelRepository properly extends BaseRepository with the correct interface type, and follows the same pattern used consistently across all repository classes.


12-13: Export approach is consistent

Providing both a named export for the singleton instance and a default export maintains consistency with the other repository modules.

src/repositories/heatMap.repository.ts (2)

6-10: LGTM: Repository class implementation is clean

The implementation correctly extends BaseRepository with the appropriate generic type parameter and passes the model to the base constructor. This pattern is well-structured and allows for easy dependency injection for testing.


12-13: LGTM: Consistent export pattern

Exporting both a named and default instance of the repository follows a consistent pattern, providing flexibility for different import styles.

src/repositories/role.repository.ts (1)

6-13: LGTM: Repository implementation and exports are well-structured

The implementation follows a consistent repository pattern, extending the BaseRepository with proper type parameters and providing both named and default exports of the repository instance. This is a clean approach that maintains consistency across the codebase.

src/repositories/platform.repository.ts (1)

6-13: LGTM: Repository implementation and exports are consistent

The implementation follows the same consistent repository pattern as other repositories, extending the BaseRepository with proper type parameters and providing both named and default exports of the repository instance.

src/repositories/user.repository.ts (1)

6-13: LGTM: User repository follows the established pattern

The implementation follows the same clean and consistent repository pattern as the other repositories, extending BaseRepository with proper type parameters and providing both named and default exports of the repository instance.

src/repositories/rawInfo.repository.ts (2)

6-10: LGTM! Repository pattern implementation is clean

The RawInfoRepository correctly extends the BaseRepository with the appropriate type parameter and passes the model to the base class.


12-13: LGTM! Singleton instance export provides convenient access

Exporting both named and default exports provides flexibility for consumers of this module.

src/repositories/guildMember.repository.ts (2)

6-10: LGTM! Repository pattern implementation is clean

The GuildMemberRepository correctly extends the BaseRepository with the appropriate type parameter and passes the model to the base class.


12-13: LGTM! Singleton instance export provides convenient access

Exporting both named and default exports provides flexibility for consumers of this module.

src/repositories/index.ts (2)

1-14: LGTM! Well-organized imports

The imports are structured in a logical manner, starting with the base repository class followed by all specialized repository instances.


15-29: LGTM! Effective centralization of repository exports

This export pattern provides a single entry point for all repository functionality, which simplifies imports in consumer code.

src/repositories/announcement.repository.ts (2)

6-10: LGTM! Repository pattern implementation is clean

The AnnouncementRepository correctly extends the BaseRepository with the appropriate type parameter and passes the model to the base class.


12-13: LGTM! Singleton instance export provides convenient access

Exporting both named and default exports provides flexibility for consumers of this module.

src/repositories/memberActivity.repository.ts (1)

12-13: LGTM: Repository instance export pattern is consistent.

The pattern of exporting a singleton instance both as a named export and default export is consistent with the repository pattern being implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant