# Cloud IDE LMS Model

[![Version](https://img.shields.io/badge/version-1.0.67-blue.svg)](https://gitlab.com/lms-schools/cloud-ide-lms-model)
[![License](https://img.shields.io/badge/license-ISC-green.svg)](https://gitlab.com/lms-schools/cloud-ide-lms-model)

## Description
This package contains the data models, schemas, and utilities for the Cloud IDE Learning Management System (LMS). It provides a consistent interface for database operations, API routes, and type definitions used throughout the Cloud IDE LMS ecosystem.

## Installation

```bash
npm install cloud-ide-lms-model
```

## Project Structure

The project is organized into several main directories:

### Schema (`/src/schema`)

Contains database schema definitions for the application.

- `collection_names.ts`: Defines the collection names used in the database
- `auth/`: Contains authentication-related schemas
- `core/`: Contains core system schemas
- `email/`: Contains email service related schemas

[More details about Schema](./src/schema/README.md)

### Common Types (`/src/common-types`)

Contains TypeScript type definitions used throughout the application.

- `common.ts`: Basic common types used throughout the system
- `coreControllerResponse.ts`: Response types for core controllers
- `jwtPayload.ts`: Type definition for JWT authentication payload
- `loginControllerResponse.ts`: Response types for login operations
- `userPermissions.ts`: Types related to user permissions and authorization

[More details about Common Types](./src/common-types/README.md)

### Models (`/src/model`)

Contains the data models that implement business logic.

- `auth/`: Authentication-related models
- `core/`: Core system models

[More details about Models](./src/model/README.md)

### Routes (`/src/routes`)

Contains API route definitions.

- `authRoutes.ts`: Authentication-related routes
- `controllerRoutes.ts`: General controller route utilities
- `coreRoutes.ts`: Core application routes
- `designConfigRoutes.ts`: Routes for design configuration
- `hostManagerRoutes.ts`: Host management routes
- `userRoutes.ts`: User management routes

[More details about Routes](./src/routes/README.md)

### Utilities (`/src/utilities`)

Contains utility functions and helper methods.

- `helpers/`: Helper functions grouped by functionality

[More details about Utilities](./src/utilities/README.md)

## Usage Examples

### Importing Types

```typescript
import { 
  CoreControllerResponse, 
  JwtPayload 
} from 'cloud-ide-lms-model';

// Use types in your code
function processResponse(response: CoreControllerResponse) {
  // Implementation
}
```

### Using Schemas

```typescript
import { SomeSchema } from 'cloud-ide-lms-model';

// Use schema for validation or type checking
```

### Using Models

```typescript
import { SomeModel } from 'cloud-ide-lms-model';

// Example usage
async function useModel() {
  const result = await SomeModel.findById(id);
  // Process result
}
```

### Using Routes

```typescript
import { authRoutes, coreRoutes } from 'cloud-ide-lms-model';
import express from 'express';

const app = express();

// Register routes
app.use('/auth', authRoutes);
app.use('/core', coreRoutes);
```

## Development

### Building the Project

```bash
npm run build
```

### Testing

```bash
npm test
```

## Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature/my-new-feature`
5. Submit a pull request

## License

This project is licensed under the ISC License - see the LICENSE file for details.

## Authors

- Ankush Bhure - Initial work and maintenance

## Repository

The project is hosted on GitLab:
https://gitlab.com/lms-schools/cloud-ide-lms-model.git
