Initial commit

This commit is contained in:
2025-10-28 11:50:15 +00:00
commit 057359608b
21 changed files with 1742 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
/**
* Auth validation endpoint Swagger configuration
*/
export const authValidateEndpoint = {
'/auth/validate': {
get: {
summary: 'Validate authentication token (GET)',
description: 'Validates the auth token parameter via query parameter',
security: [
{ ApiKeyAuth: [] },
{ BearerAuth: [] }
],
parameters: [
{
name: 'auth',
in: 'query',
description: 'Authentication token',
required: true,
schema: {
type: 'string',
},
},
],
responses: {
'200': {
description: 'Authentication successful',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
firstname: {
type: 'string',
example: 'John'
},
lastname: {
type: 'string',
example: 'Doe'
},
email: {
type: 'string',
example: 'john.doe@example.com'
}
}
}
}
}
},
'401': {
description: 'Authentication failed',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Authentication failed',
},
},
},
},
},
},
'500': {
description: 'Server error',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Authentication failed',
},
},
},
},
},
},
},
},
post: {
summary: 'Validate authentication token (POST)',
description: 'Validates the auth token parameter via request body',
security: [
{ ApiKeyAuth: [] },
{ BearerAuth: [] }
],
requestBody: {
required: true,
content: {
'application/json': {
schema: {
type: 'object',
required: ['auth'],
properties: {
auth: {
type: 'string',
description: 'Authentication token'
}
}
}
}
}
},
responses: {
'200': {
description: 'Authentication successful',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
firstname: {
type: 'string',
example: 'John'
},
lastname: {
type: 'string',
example: 'Doe'
},
email: {
type: 'string',
example: 'john.doe@example.com'
}
}
}
}
}
},
'401': {
description: 'Authentication failed',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Authentication failed'
}
}
}
}
}
},
'500': {
description: 'Server error',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Authentication failed'
}
}
}
}
}
}
}
}
}
};

View File

@@ -0,0 +1,125 @@
/**
* Decrypt and save endpoint Swagger configuration
*/
export const decryptAndSaveEndpoint = {
'/auth/decrypt-and-save': {
post: {
summary: 'Decrypt auth token and save user data to database',
description: 'Decrypts the provided auth token and saves the user data to the D1 database',
security: [
{ ApiKeyAuth: [] },
{ BearerAuth: [] }
],
requestBody: {
required: true,
content: {
'application/json': {
schema: {
type: 'object',
required: ['auth'],
properties: {
auth: {
type: 'string',
description: 'Authentication token to decrypt'
}
}
}
}
}
},
responses: {
'200': {
description: 'User data successfully saved',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: {
type: 'boolean',
example: true
},
message: {
type: 'string',
example: 'User data saved successfully'
},
updated: {
type: 'boolean',
example: false
},
uid: {
type: 'string',
example: '426bcea5-adb9-4580-a8ca-3a40fdb0ef85'
},
userData: {
type: 'object',
properties: {
uid: {
type: 'string',
example: '426bcea5-adb9-4580-a8ca-3a40fdb0ef85'
},
email: {
type: 'string',
example: 'humanizeiq@eteaminc.com'
},
firebase_uid: {
type: 'string',
example: 'wFyjGE1j8wclXayUvPbkF4c15f92'
},
firstname: {
type: 'string',
example: 'Rajeev'
},
lastname: {
type: 'string',
example: 'Borborah'
},
company_name: {
type: 'string',
nullable: true,
example: null
}
}
}
}
}
}
}
},
'401': {
description: 'Authentication failed',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Invalid auth parameter'
}
}
}
}
}
},
'500': {
description: 'Server error',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
error: {
type: 'string',
example: 'Failed to save user data'
}
}
}
}
}
}
}
}
}
};

View File

@@ -0,0 +1,42 @@
/**
* Health endpoint Swagger configuration
*/
export const healthEndpoint = {
'/health': {
get: {
summary: 'Health check endpoint',
description: 'Returns the status of the API',
security: [
{ ApiKeyAuth: [] },
{ BearerAuth: [] }
],
responses: {
'200': {
description: 'API is running',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
status: {
type: 'string',
example: 'ok',
},
message: {
type: 'string',
example: 'Auth SecureChat API is running',
},
version: {
type: 'string',
example: '1.0.0',
},
},
},
},
},
},
},
},
}
};