Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
add doc comments, tag as pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Smith authored and Peter Smith committed Mar 18, 2016
1 parent 41b12de commit f7c4bac
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 6 deletions.
Binary file removed assets/actionbar_style_humhubdemo.zip
Binary file not shown.
Binary file removed assets/android-holo-colors-humhubdemp.zip
Binary file not shown.
3 changes: 1 addition & 2 deletions controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use yii\web\BadRequestHttpException;

/**
* CommentController implements an interface and actions for CRUD for the coomenttable.
* CommentController implements an interface and actions for CRUD for the cooment table.
*
* @author petersmithca
*/
Expand Down Expand Up @@ -47,7 +47,6 @@ public function actions()

/**
* Overrides Index functionality to sort comments and limit result set
* @param integer $id
* @return mixed
*/
public function actionIndex(){
Expand Down
9 changes: 8 additions & 1 deletion controllers/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
use humhub\modules\api\controllers\BaseController;
use humhub\modules\notification\models\Notification;

/**
* NotificationController implements an interface and actions for listing notifications.
*
* @author petersmithca
*/
class NotificationController extends BaseController
{
public $modelClass = 'humhub\modules\notification\models\Notification';

/**
* @inheritdoc
*/
public function actions()
{
$actions = parent::actions();
Expand All @@ -18,7 +26,6 @@ public function actions()

/**
* Overrides Index functionality to return only unseeen notifications
* @param integer $id
* @return mixed
*/
public function actionIndex(){
Expand Down
1 change: 1 addition & 0 deletions controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class PostController extends BaseController
{
public $modelClass = 'humhub\modules\api\models\Post';

/**
* @inheritdoc
*/
Expand Down
3 changes: 3 additions & 0 deletions controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class ProfileController extends BaseController
{
public $modelClass = 'humhub\modules\api\models\Profile';

/**
* @inheritdoc
*/
public function actions()
{
$actions = parent::actions();
Expand Down
3 changes: 3 additions & 0 deletions controllers/SpaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class SpaceController extends BaseController
{
public $modelClass = 'humhub\modules\space\models\Space';

/**
* @inheritdoc
*/
public function actions()
{
$actions = parent::actions();
Expand Down
21 changes: 21 additions & 0 deletions controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ class UserController extends BaseController
{
public $modelClass = 'humhub\modules\api\models\User';

/**
* @inheritdoc
*/
public function actions()
{
$actions = parent::actions();
unset($actions['index'], $actions['view'], $actions['delete'], $actions['update'], $actions['create']);
return $actions;
}

/**
* Allows searching users by user name, returning a list of matches.
* @param string $search
* @return mixed
*/
public function actionSearch($search)
{
$request = Yii::$app->request;
Expand All @@ -32,6 +40,13 @@ public function actionSearch($search)
return $query->all();
}

/**
* Login end point, which will return a user matching the passes uername and password
* including walls
* @param string $username
* @param string $password
* @return mixed
*/
public function actionLogin($username, $password) {
$auth = new AccountLogin();
$auth->username = $username;
Expand All @@ -47,6 +62,12 @@ public function actionLogin($username, $password) {
}
}

/**
* Overrides Index functionality to return a list of users
* will include the user's profile if the optional `eager` paramter is true
* @param boolean $eager
* @return mixed
*/
public function actionIndex($eager = false){

$users = User::find()
Expand Down
5 changes: 4 additions & 1 deletion models/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
use humhub\modules\api\models\Post;

/**
* User model extends humhub User model to implement relationships.
* Content model extends humhub Content model to implement relationships.
*
* @author petersmithca
*/
class Content extends \humhub\modules\content\models\Content
{
/**
* Identifies relationship between Content and Post
*/
public function getPosts()
{
return $this->hasMany(Post::className(), ['id' => 'object_id']);
Expand Down
6 changes: 5 additions & 1 deletion models/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
use humhub\modules\api\models\User;

/**
* User model extends humhub User model to implement relationships.
* Profile model extends humhub Profile model to implement relationships.
*
* @author petersmithca
*/
class Profile extends \humhub\modules\user\models\Profile
{

/**
* Identifies relationship between Profile and User
*/
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id']);
Expand Down
7 changes: 7 additions & 0 deletions models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@
*/
class User extends \humhub\modules\user\models\User
{

/**
* Identifies relationship between User and Post
*/
public function getPosts()
{
return $this->hasMany(Post::className(), ['created_by' => 'id']);
}

/**
* Identifies relationship between User and Profile
*/
public function getProfile()
{
return $this->hasOne(Profile::className(), ['user_id' => 'id']);
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "API",
"description": "Adds REST EPI Endpoints.",
"keywords": ["api", "rest"],
"version": "0.1.0",
"version": "0.9.0",
"humhub": {
"minVersion": "0.20"
}
Expand Down

0 comments on commit f7c4bac

Please sign in to comment.