Agents
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
AGENTS.md
|
||||||
@@ -288,17 +288,29 @@ class Playground extends CI_Controller
|
|||||||
['method' => 'GET', 'path' => '/estimates/search/{keyword}', 'description' => 'Search estimates']
|
['method' => 'GET', 'path' => '/estimates/search/{keyword}', 'description' => 'Search estimates']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'contracts' => [
|
'customers' => [
|
||||||
'name' => 'Contracts',
|
'name' => 'Customers',
|
||||||
'description' => 'Manage client contracts and agreements',
|
'description' => 'Manage customer data and information',
|
||||||
'endpoints' => [
|
'endpoints' => [
|
||||||
['method' => 'GET', 'path' => '/contracts', 'description' => 'Get all contracts'],
|
['method' => 'GET', 'path' => '/customers', 'description' => 'Get all customers'],
|
||||||
['method' => 'POST', 'path' => '/contracts', 'description' => 'Create new contract'],
|
['method' => 'POST', 'path' => '/customers', 'description' => 'Create new customer'],
|
||||||
['method' => 'GET', 'path' => '/contracts/{id}', 'description' => 'Get specific contract'],
|
['method' => 'GET', 'path' => '/customers/{id}', 'description' => 'Get specific customer'],
|
||||||
['method' => 'PUT', 'path' => '/contracts/{id}', 'description' => 'Update contract'],
|
['method' => 'PUT', 'path' => '/customers/{id}', 'description' => 'Update customer'],
|
||||||
['method' => 'DELETE', 'path' => '/contracts/{id}', 'description' => 'Delete contract']
|
['method' => 'DELETE', 'path' => '/customers/{id}', 'description' => 'Delete customer'],
|
||||||
]
|
['method' => 'GET', 'path' => '/customers/search/{keyword}', 'description' => 'Search customers']
|
||||||
],
|
]
|
||||||
|
],
|
||||||
|
'contracts' => [
|
||||||
|
'name' => 'Contracts',
|
||||||
|
'description' => 'Manage client contracts and agreements',
|
||||||
|
'endpoints' => [
|
||||||
|
['method' => 'GET', 'path' => '/contracts', 'description' => 'Get all contracts'],
|
||||||
|
['method' => 'POST', 'path' => '/contracts', 'description' => 'Create new contract'],
|
||||||
|
['method' => 'GET', 'path' => '/contracts/{id}', 'description' => 'Get specific contract'],
|
||||||
|
['method' => 'PUT', 'path' => '/contracts/{id}', 'description' => 'Update contract'],
|
||||||
|
['method' => 'DELETE', 'path' => '/contracts/{id}', 'description' => 'Delete contract']
|
||||||
|
]
|
||||||
|
],
|
||||||
'credit_notes' => [
|
'credit_notes' => [
|
||||||
'name' => 'Credit Notes',
|
'name' => 'Credit Notes',
|
||||||
'description' => 'Manage credit notes and refunds',
|
'description' => 'Manage credit notes and refunds',
|
||||||
@@ -374,17 +386,28 @@ class Playground extends CI_Controller
|
|||||||
['method' => 'DELETE', 'path' => '/proposals/{id}', 'description' => 'Delete proposal']
|
['method' => 'DELETE', 'path' => '/proposals/{id}', 'description' => 'Delete proposal']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'subscriptions' => [
|
'staffs' => [
|
||||||
'name' => 'Subscriptions',
|
'name' => 'Staff',
|
||||||
'description' => 'Manage recurring subscriptions and billing',
|
'description' => 'Manage staff members and user accounts',
|
||||||
'endpoints' => [
|
'endpoints' => [
|
||||||
['method' => 'GET', 'path' => '/subscriptions', 'description' => 'Get all subscriptions'],
|
['method' => 'GET', 'path' => '/staffs', 'description' => 'Get all staff members'],
|
||||||
['method' => 'POST', 'path' => '/subscriptions', 'description' => 'Create new subscription'],
|
['method' => 'POST', 'path' => '/staffs', 'description' => 'Create new staff member'],
|
||||||
['method' => 'GET', 'path' => '/subscriptions/{id}', 'description' => 'Get specific subscription'],
|
['method' => 'GET', 'path' => '/staffs/{id}', 'description' => 'Get specific staff member'],
|
||||||
['method' => 'PUT', 'path' => '/subscriptions/{id}', 'description' => 'Update subscription'],
|
['method' => 'PUT', 'path' => '/staffs/{id}', 'description' => 'Update staff member'],
|
||||||
['method' => 'DELETE', 'path' => '/subscriptions/{id}', 'description' => 'Delete subscription']
|
['method' => 'DELETE', 'path' => '/staffs/{id}', 'description' => 'Delete staff member']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'subscriptions' => [
|
||||||
|
'name' => 'Subscriptions',
|
||||||
|
'description' => 'Manage recurring subscriptions and billing',
|
||||||
|
'endpoints' => [
|
||||||
|
['method' => 'GET', 'path' => '/subscriptions', 'description' => 'Get all subscriptions'],
|
||||||
|
['method' => 'POST', 'path' => '/subscriptions', 'description' => 'Create new subscription'],
|
||||||
|
['method' => 'GET', 'path' => '/subscriptions/{id}', 'description' => 'Get specific subscription'],
|
||||||
|
['method' => 'PUT', 'path' => '/subscriptions/{id}', 'description' => 'Update subscription'],
|
||||||
|
['method' => 'DELETE', 'path' => '/subscriptions/{id}', 'description' => 'Delete subscription']
|
||||||
|
]
|
||||||
|
],
|
||||||
'milestones' => [
|
'milestones' => [
|
||||||
'name' => 'Milestones',
|
'name' => 'Milestones',
|
||||||
'description' => 'Manage project milestones and deliverables',
|
'description' => 'Manage project milestones and deliverables',
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ class api_aeiou
|
|||||||
return ((false === $verify_obj) || !is_object($verify_obj) || isset($verify_obj->error) || !isset($verify_obj->sold_at) || ('' == $verify_obj->supported_until)) ? $verify_obj : null;
|
return ((false === $verify_obj) || !is_object($verify_obj) || isset($verify_obj->error) || !isset($verify_obj->sold_at) || ('' == $verify_obj->supported_until)) ? $verify_obj : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validatePurchase($module_name)
|
public function validatePurchase($module_name)
|
||||||
{
|
{
|
||||||
$module = get_instance()->app_modules->get($module_name);
|
$module = get_instance()->app_modules->get($module_name);
|
||||||
$verified = false;
|
$verified = false;
|
||||||
$verification_id = get_option($module_name . '_verification_id');
|
$verification_id = get_option($module_name . '_verification_id');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!empty($verification_id)) {
|
if (!empty($verification_id)) {
|
||||||
$verification_id = base64_decode($verification_id);
|
$verification_id = base64_decode($verification_id);
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ class Migration_Version_210 extends App_module_migration
|
|||||||
WHERE request_limit IS NULL OR request_limit = 0
|
WHERE request_limit IS NULL OR request_limit = 0
|
||||||
");
|
");
|
||||||
|
|
||||||
// Drop the separate user_api_quotas table (no longer needed)
|
// Drop the separate user_api_quotas table (no longer needed)
|
||||||
$this->db->query("DROP TABLE IF EXISTS `" . db_prefix() . "user_api_quotas`");
|
$this->db->query("DROP TABLE IF EXISTS `" . db_prefix() . "user_api_quotas`");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
@@ -101,15 +101,15 @@ class Migration_Version_210 extends App_module_migration
|
|||||||
WHERE request_limit IS NOT NULL
|
WHERE request_limit IS NOT NULL
|
||||||
");
|
");
|
||||||
|
|
||||||
// Remove quota fields from user_api table
|
// Remove quota fields from user_api table
|
||||||
$this->db->query("
|
$this->db->query("
|
||||||
ALTER TABLE `" . db_prefix() . "user_api`
|
ALTER TABLE `" . db_prefix() . "user_api`
|
||||||
DROP COLUMN `request_limit`,
|
DROP COLUMN `request_limit`,
|
||||||
DROP COLUMN `time_window`,
|
DROP COLUMN `time_window`,
|
||||||
DROP COLUMN `burst_limit`,
|
DROP COLUMN `burst_limit`,
|
||||||
DROP COLUMN `quota_active`,
|
DROP COLUMN `quota_active`,
|
||||||
DROP COLUMN `quota_created_at`,
|
DROP COLUMN `quota_created_at`,
|
||||||
DROP COLUMN `quota_updated_at`
|
DROP COLUMN `quota_updated_at`
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
api/migrations/211_version_211.php
Normal file
49
api/migrations/211_version_211.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Migration_Version_211 extends App_module_migration
|
||||||
|
{
|
||||||
|
/** @var CI_DB_query_builder */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// Properly initialize the database once the migration is constructed
|
||||||
|
$CI = &get_instance();
|
||||||
|
$CI->load->database();
|
||||||
|
$this->db = $CI->db;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
// Add rate limiting columns to api_usage_logs table
|
||||||
|
if (!$this->db->field_exists('rate_limit_checked', db_prefix() . 'api_usage_logs')) {
|
||||||
|
$this->db->query("
|
||||||
|
ALTER TABLE `" . db_prefix() . "api_usage_logs`
|
||||||
|
ADD `rate_limit_checked` tinyint(1) NOT NULL DEFAULT 0 AFTER `user_agent`,
|
||||||
|
ADD `rate_limit_type` varchar(20) NULL AFTER `rate_limit_checked`,
|
||||||
|
ADD `rate_limit_limit` int(11) NULL AFTER `rate_limit_type`,
|
||||||
|
ADD `rate_limit_current` int(11) NULL AFTER `rate_limit_limit`,
|
||||||
|
ADD `rate_limit_exceeded` tinyint(1) NOT NULL DEFAULT 0 AFTER `rate_limit_current`
|
||||||
|
");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
// Remove rate limiting columns from api_usage_logs table
|
||||||
|
if ($this->db->field_exists('rate_limit_checked', db_prefix() . 'api_usage_logs')) {
|
||||||
|
$this->db->query("
|
||||||
|
ALTER TABLE `" . db_prefix() . "api_usage_logs`
|
||||||
|
DROP COLUMN `rate_limit_checked`,
|
||||||
|
DROP COLUMN `rate_limit_type`,
|
||||||
|
DROP COLUMN `rate_limit_limit`,
|
||||||
|
DROP COLUMN `rate_limit_current`,
|
||||||
|
DROP COLUMN `rate_limit_exceeded`
|
||||||
|
");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user