Skip to content

Commit

Permalink
Merge pull request #1 from PlatinMarket/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bdogan committed Jul 8, 2015
2 parents e6c7830 + 0049c1c commit b63d45e
Show file tree
Hide file tree
Showing 58 changed files with 2,271 additions and 781 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#################################################
/app/webroot/components
/app/Config/database.php
/app/Config/config.php
/app/tmp
/lib/Cake/Console/Templates/skel/tmp/
/plugins
Expand Down
117 changes: 117 additions & 0 deletions app/Config/Schema/schema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php
class AppSchema extends CakeSchema {

public function before($event = array()) {
return true;
}

public function after($event = array()) {
}

public $access_tokens = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'token' => array('type' => 'string', 'null' => false, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'lifetime' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $customers = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'domain' => array('type' => 'string', 'null' => false, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'uuid' => array('type' => 'string', 'null' => false, 'length' => 45, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'name' => array('type' => 'string', 'null' => true, 'length' => 70, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'mail' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 70, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'is_installed' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'is_develop' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $filters = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'label' => array('type' => 'string', 'null' => false, 'length' => 45, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'remote' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 45, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'query' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'customer_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $member_mappers = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'grupid' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'filter_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $refresh_tokens = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'token' => array('type' => 'string', 'null' => false, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'lifetime' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $setrow = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'api_key' => array('type' => 'string', 'null' => false, 'length' => 50, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $sync_config = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'active' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
'period' => array('type' => 'integer', 'null' => false, 'default' => '1', 'unsigned' => false),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

public $sync_track = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => true, 'key' => 'primary'),
'customer_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false),
'alias' => array('type' => 'string', 'null' => false, 'length' => 45, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'last_created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_try' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_success' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_error' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_message' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1)
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);

}
133 changes: 133 additions & 0 deletions app/Config/Schema/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
DROP TABLE IF EXISTS `access_tokens`;

CREATE TABLE `access_tokens` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`token` varchar(40) NOT NULL DEFAULT '',
`customer_id` int(11) NOT NULL,
`lifetime` int(11) NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO access_tokens VALUES (3,'285ccac022335ee75da9ba9d63e54ca6cb3db2cf',1,-1,'2015-07-06 19:44:13');



DROP TABLE IF EXISTS `customers`;

CREATE TABLE `customers` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`domain` varchar(100) NOT NULL DEFAULT '',
`uuid` varchar(45) NOT NULL DEFAULT '',
`name` varchar(70) DEFAULT '',
`mail` varchar(70) DEFAULT NULL,
`is_installed` tinyint(1) NOT NULL DEFAULT '0',
`is_develop` tinyint(1) NOT NULL DEFAULT '0',
`created` datetime NOT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO customers VALUES (1,'bayanpazar.com','5c5392fa-18ef-11e5-88b9-000c29212a08','Burak Doğan','burak@platinmarket.com',1,1,'2015-07-02 13:59:10','2015-07-02 15:46:19');



DROP TABLE IF EXISTS `filters`;

CREATE TABLE `filters` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`label` varchar(45) NOT NULL DEFAULT '',
`remote` varchar(45) DEFAULT NULL,
`query` text NOT NULL,
`customer_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO filters VALUES (1,'Bayan Kullanıcılar','Member','a:1:{s:17:\"Member.member_SEX\";i:2;}',NULL);
INSERT INTO filters VALUES (2,'Erkek Kullanıcılar','Member','a:1:{s:17:\"Member.member_SEX\";i:1;}',NULL);
INSERT INTO filters VALUES (3,'Tüm Kullanıcılar','Member','a:0:{}',NULL);



DROP TABLE IF EXISTS `member_mappers`;

CREATE TABLE `member_mappers` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`grupid` int(11) NOT NULL,
`filter_id` int(11) NOT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;

INSERT INTO member_mappers VALUES (24,1,24089,3,'2015-07-08 10:55:20','2015-07-08 18:11:55');



DROP TABLE IF EXISTS `refresh_tokens`;

CREATE TABLE `refresh_tokens` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`token` varchar(40) NOT NULL DEFAULT '',
`customer_id` int(11) NOT NULL,
`lifetime` int(11) NOT NULL,
`created` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO refresh_tokens VALUES (3,'1f9c4ef44b5d7f87b447a762c5f6876d60abe4fa',1,1206900,'2015-07-06 19:44:13');



DROP TABLE IF EXISTS `setrow`;

CREATE TABLE `setrow` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`api_key` varchar(50) NOT NULL DEFAULT '',
`created` datetime NOT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

INSERT INTO setrow VALUES (1,1,'ueoJuCbU7tVkN0lhRBNx343TqxbgbofB612DVXXxdQrQZ3ertg','2015-07-02 15:39:58','2015-07-08 18:11:55');



DROP TABLE IF EXISTS `sync_config`;

CREATE TABLE `sync_config` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`active` tinyint(1) NOT NULL DEFAULT '1',
`period` int(11) NOT NULL DEFAULT '1',
`customer_id` int(11) NOT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

INSERT INTO sync_config VALUES (1,1,5,1,'2015-07-07 23:15:03','2015-07-08 18:11:55');



DROP TABLE IF EXISTS `sync_track`;

CREATE TABLE `sync_track` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`alias` varchar(45) NOT NULL DEFAULT '',
`last_created` datetime DEFAULT NULL,
`last_modified` datetime DEFAULT NULL,
`last_try` datetime DEFAULT NULL,
`last_success` datetime DEFAULT NULL,
`last_error` datetime DEFAULT NULL,
`last_message` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

INSERT INTO sync_track VALUES (1,1,'Member:Filter:3','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','');
INSERT INTO sync_track VALUES (2,1,'Member:Filter:1','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','1970-01-01 00:00:01','');



10 changes: 10 additions & 0 deletions app/Config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

// Call Config
require_once 'config.php';

// Setup a 'default' cache configuration for use in the application.
Cache::config('default', array('engine' => 'File'));

Expand Down Expand Up @@ -74,8 +77,15 @@
*
*/

// BoostCake
CakePlugin::load('BoostCake');

// SetrowApi
CakePlugin::load(array('Setrow' => array('bootstrap' => true)));

// ReformApi
CakePlugin::load(array('ReformApi' => array('bootstrap' => true)));

/**
* To prefer app translation over plugin translation, you can set
*
Expand Down
30 changes: 30 additions & 0 deletions app/Config/config.php.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

// Client Id
Configure::write('PlatinMarket.ClientID', '');

// Client Secret
Configure::write('PlatinMarket.ClientSecret', '');

// Application UUID
Configure::write('PlatinMarket.ApplicationUUID', '');

// Platform UUID
Configure::write('PlatinMarket.PlatformUUID', '');

// Application Permission Scope
Configure::write('PlatinMarket.Scope', '*:*');

// ReformApi Location
Configure::write('PlatinMarket.Api', array(
'protocol' => 'http',
'host' => 'developer.platinmarket.com',
'path' => '/reform'
));

// OAuth Location
Configure::write('PlatinMarket.OAuth', array(
'protocol' => 'http',
'host' => 'developer.platinmarket.com',
'path' => '/oauth/authorize'
));
2 changes: 1 addition & 1 deletion app/Config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
* then the value of `Config.timezone` will be used. This feature allows you to set users' timezone just
* once instead of passing it each time in function calls.
*/
//Configure::write('Config.timezone', 'Europe/Paris');
Configure::write('Config.timezone', 'Europe/Istanbul');

/**
* Cache Engine Configuration
Expand Down
8 changes: 8 additions & 0 deletions app/Config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
* ...and connect the rest of 'Pages' controller's URLs.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/session_start', array('controller' => 'pages', 'action' => 'display'));

// OAuth Callback
Router::connect('/oauth/callback', array('controller' => 'oauth', 'action' => 'callback'));

// SessionId
Router::connect('/:session_id/:controller/:action', array(), array('session_id' => '[a-z|A-Z|0-9]+'));
Router::connect('/:session_id/:controller', array('action' => 'index'), array('session_id' => '[a-z|A-Z|0-9]+'));

/**
* Load all plugin routes. See the CakePlugin documentation on
Expand Down
Loading

0 comments on commit b63d45e

Please sign in to comment.