From 528e6d9db158740961771f181b6092ed86a9ef56 Mon Sep 17 00:00:00 2001 From: FLYBYME Date: Sun, 19 Nov 2023 10:09:00 -0500 Subject: [PATCH 1/2] Fix bug in login functionality --- README.md | 262 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 223 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 2737fa1..f239045 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file +### 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. | From 5ef33fd957a308a6f1293adb982b139924fbeafe Mon Sep 17 00:00:00 2001 From: FLYBYME Date: Sun, 19 Nov 2023 10:38:05 -0500 Subject: [PATCH 2/2] Update repository service parameters --- services/repositories.service.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/services/repositories.service.js b/services/repositories.service.js index 7190311..df7176f 100644 --- a/services/repositories.service.js +++ b/services/repositories.service.js @@ -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) { @@ -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