Commit 070040ac authored by Alessio Parma's avatar Alessio Parma 🐔

api keys table

parent 2983b865
......@@ -69,6 +69,23 @@ Docker image can be configured using the following environment variables:
| `Website__Enabled` | Expose the public website. | `false` |
| `Website__GoogleAnalyticsPropertyId` | Google Analytics property ID. | |
### Database
Script for API Keys table for SQL Server:
```sql
CREATE TABLE [dbo].[api_keys](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](100) NOT NULL,
[value] [nchar](32) NOT NULL,
[expires_at] [datetimeoffset](7) NULL,
[temporary] [bit] NOT NULL DEFAULT 0,
CONSTRAINT [pk_api_keys] PRIMARY KEY CLUSTERED ([id] ASC),
CONSTRAINT [ak_api_keys] UNIQUE ([name] ASC)
)
GO
```
## Usage
Sample web service calls can be found on [Thumbnailer RapidAPI page][rapidapi-endpoints].
......
......@@ -42,7 +42,7 @@ public sealed class ApiKey
/// Sequential ID.
/// </summary>
[Column(Name = "id"), PrimaryKey, Identity]
public int Id { get; set; }
public long Id { get; set; }
/// <summary>
/// Descriptive name.
......
......@@ -60,7 +60,7 @@ public async Task<ApiKeyDTO> AddTempApiKeyAsync(CancellationToken cancellationTo
var utcNow = _clock.UtcNow;
var tmpApiKey = new ApiKey
{
Name = $"tmp#{utcNow.ToUnixTimeSeconds()}",
Name = $"TMP#{utcNow.ToUnixTimeSeconds()}",
Value = GetNewApiKeyValue(),
ExpiresAt = utcNow.AddMinutes(15),
Temporary = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment