Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in login functionality #1

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 223 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,246 @@
# Overview of Services

These are a set of services for managing email messages. They include functionality for receiving, parsing, signing, and sending email messages. The services are designed to be used together, but they can also be used independently. The services are designed to be used with the [MolecularJS]
# Git Service

## Installation
HTTP git server. This service provides a HTTP git server for managing git repositories.
Push pull and clone are supported.

```bash
git clone https://github.com/paas-shack/email.git
cd email
npm i
npm run dev
```
## Service Fields

## Kubernetes Install
| Field | Type | Description |
|--------------------|---------|----------------------------------------------------|
| `name` | string | Name of the service. |
| `version` | 1 | Version of the service. |

YAML files are included to deploy the services to a Kubernetes cluster. The following command will deploy the services to a Kubernetes cluster:
## Service Mixins

```bash
kubectl apply -f yaml
```
| Mixin | Type | Description |
|--------------------|-------------|-----------------------------------------------|
| `ConfigLoader` | ConfigLoader | Config loader mixin for loading configuration. |

## Service Settings

## Requirements
| Setting | Type | Description |
|--------------------|---------|---------------------------------------|
| `rest` | true | Enable REST endpoint. |
| `config` | | Default init config settings. |

The `emails` service requires the following:
## Actions

- An S3 bucket for storing email messages.
- A MongoDB database for storing email-related data.
- A DKIM key pair for signing email messages.
- A valid domain name for sending email messages.
- A valid MX record for the domain name.
- A valid SPF record for the domain name.
- A valid DMARC record for the domain name. TODO: Add DMARC support.
### 1. `handleRequest`

| Parameter | Type | Description |
|-----------|--------|----------------------------|
| `req` | object | HTTP request object. |
| `res` | object | HTTP response object. |

# Services
### 2. `listRepositories`

The following services are included:
| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

- `emails.outbound`: Handles outbound email communication.
- `emails.inbound`: Handles inbound email communication.
- `emails.messages`: Manages email messages.
- `emails.templates`: Manages email templates. TODO: Add support for email templates.
- `emails.accounts`: Manages email users.
### 3. `connectionCount`

## `emails.outbound` Service
| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

The `emails.outbound` service is designed for handling outbound email communication. It is responsible for sending emails, managing email pools, and integrating with a database for persistence.
### 4. `createBareRepository`

- [Documentation](docs/outbound.md)
| Parameter | Type | Description |
|-----------|--------|--------------------------|
| `id` | string | Repository ID. |

## `emails.inbound` Service
## Events

The `emails.inbound` service is an inbound SMTP server designed to handle incoming email messages. It provides functionality for receiving, processing, and storing incoming emails.
### 1. `git.repositories.created`

- [Documentation](docs/inbound.md)
| Parameter | Type | Description |
|-----------|--------|------------------|
| `ctx` | object | Context object. |

## `emails.messages` Service
### 2. `git.repositories.updated`

The `emails.messages` service is designed for managing email messages, including storing, parsing, signing, queuing, and adding additional information to email messages.
| Parameter | Type | Description |
|-----------|--------|------------------|
| `ctx` | object | Context object. |

- [Documentation](docs/messages.md)
### 3. `git.repositories.removed`

| Parameter | Type | Description |
|-----------|--------|------------------|
| `ctx` | object | Context object. |

## Methods

### 1. `createHttpServer`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

### 2. `handleRequest`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `req` | http.IncomingMessage | HTTP request object. |
| `res` | http.ServerResponse | HTTP response object. |
| `service` | object | Service object. |
| `repositoryPath` | string | Path to the repository. |

### 3. `handleCommit`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `req` | http.IncomingMessage | HTTP request object. |
| `res` | http.ServerResponse | HTTP response object. |
| `service` | object | Service object. |
| `repositoryPath` | string | Path to the repository. |

### 4. `getCommit`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `repositoryPath` | string | Path to the repository. |
| `head` | string | Head of the commit. |

### 5. `readCommitMessage`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `commit` | object | Commit object. |

### 6. `handleService`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `req` | http.IncomingMessage | HTTP request object. |
| `res` | http.ServerResponse | HTTP response object. |
| `service` | object | Service object. |
| `repositoryPath` | string | Path to the repository. |

### 7. `closeHttpServer`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| None | | No parameters. |

### 8. `createBareRepository`

| Parameter | Type | Description |
|--------------------|-------------------------|-------------------------------|
| `ctx` | Context | Context of the request. |
| `repository` | object | Repository object. |

## Lifecycle

### 1. `created`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

### 2. `started`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

### 3. `stopped`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |





# Commit Service

Commit service. This service provides a commit service for managing commits.

## Service Fields

| Field | Type | Description |
|--------------------|---------|----------------------------------------------------|
| `name` | string | Name of the service. |
| `version` | 1 | Version of the service. |

## Service Mixins

| Mixin | Type | Description |
|--------------------|-------------|-----------------------------------------------|
| `DbService` | DbService | Database mixin. |
| `ConfigLoader` | ConfigLoader | Config loader mixin for loading configuration. |

## Service Settings

| Setting | Type | Description |
|--------------------|---------|---------------------------------------|
| `rest` | true | Enable REST endpoint. |
| `fields` | object | Service fields configuration. |
| `defaultPopulates` | array | Default populates array. |
| `scopes` | object | Service scopes configuration. |
| `defaultScopes` | array | Default scopes array. |
| `config` | | Default init config settings. |

### Fields Configuration

| Field | Type | Index | Required |
|--------------------|---------|-------|----------|
| `repository` | string | true | true |
| `user` | string | true | true |
| `hash` | string | true | true |
| `branch` | string | true | false |

## Actions

| Action | Parameters | Description |
|--------------------|------------|---------------------------------------|
| ... No actions defined yet. | | |

## Events

### 1. `git.repositories.removed`

| Parameter | Type | Description |
|-----------|--------|------------------|
| `ctx` | object | Context object. |

### 2. `git.repositories.push`

| Parameter | Type | Description |
|-----------|--------|------------------|
| `ctx` | object | Context object. |

## Methods

| Method | Parameters | Description |
|--------------------|------------|---------------------------------------|
| ... No methods defined yet.

## Lifecycle

### 1. `created`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

### 2. `started`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |

### 3. `stopped`

| Parameter | Type | Description |
|-----------|--------|------------------|
| None | | No parameters. |
11 changes: 4 additions & 7 deletions services/repositories.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,16 @@ module.exports = {
params: {
id: {
type: "string",
required: true,
optional: false,
},
branch: {
type: "string",
required: false,
optional: true,
default: "main",
},
hash: {
type: "string",
required: false
optional: true
},
},
async handler(ctx) {
Expand Down Expand Up @@ -658,12 +658,9 @@ module.exports = {
*/
async getById(ctx, id) {
// get repository
const repository = await this.reolveEntities(null, {
return this.resolveEntities(null, {
id,
});

// return repository
return repository;
},
/**
* lookup repository by name and namespace
Expand Down
Loading