Rename notestutorial to upschooling

This commit is contained in:
Ben 2021-08-21 16:25:23 +02:00
parent f4bf5cb042
commit 3e17e44ab7
Signed by: ben
GPG key ID: 0F54A7ED232D3319
27 changed files with 442 additions and 192 deletions

View file

@ -8,7 +8,7 @@ on:
- stable*
env:
APP_NAME: notestutorial
APP_NAME: upschooling
jobs:
php:

View file

@ -2,7 +2,7 @@
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>upschooling</id>
<name>U Pschooling</name>
<name>UPschooling</name>
<summary>UPschooling Support Platform</summary>
<description><![CDATA[Ticketsystem für UPschooling]]></description>
<version>0.0.1</version>
@ -16,7 +16,7 @@
</dependencies>
<navigations>
<navigation>
<name>U Pschooling</name>
<name>Support</name>
<route>upschooling.page.index</route>
</navigation>
</navigations>

500
composer.lock generated

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
js/upschooling-main.js Normal file

Binary file not shown.

BIN
js/upschooling-main.js.map Normal file

Binary file not shown.

View file

@ -1,11 +1,11 @@
<?php
namespace OCA\NotesTutorial\AppInfo;
namespace OCA\UPschooling\AppInfo;
use OCP\AppFramework\App;
class Application extends App {
public const APP_ID = 'notestutorial';
public const APP_ID = 'upschooling';
public function __construct() {
parent::__construct(self::APP_ID);

View file

@ -1,13 +1,13 @@
<?php
namespace OCA\NotesTutorial\Controller;
namespace OCA\UPschooling\Controller;
use Closure;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCA\NotesTutorial\Service\NoteNotFound;
use OCA\UPschooling\Service\NoteNotFound;
trait Errors {
protected function handleNotFound(Closure $callback): DataResponse {

View file

@ -1,9 +1,9 @@
<?php
namespace OCA\NotesTutorial\Controller;
namespace OCA\UPschooling\Controller;
use OCA\NotesTutorial\AppInfo\Application;
use OCA\NotesTutorial\Service\NoteService;
use OCA\UPschooling\AppInfo\Application;
use OCA\UPschooling\Service\NoteService;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;

View file

@ -1,9 +1,9 @@
<?php
namespace OCA\NotesTutorial\Controller;
namespace OCA\UPschooling\Controller;
use OCA\NotesTutorial\AppInfo\Application;
use OCA\NotesTutorial\Service\NoteService;
use OCA\UPschooling\AppInfo\Application;
use OCA\UPschooling\Service\NoteService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;

View file

@ -1,8 +1,8 @@
<?php
namespace OCA\NotesTutorial\Controller;
namespace OCA\UPschooling\Controller;
use OCA\NotesTutorial\AppInfo\Application;
use OCA\UPschooling\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
@ -20,7 +20,7 @@ class PageController extends Controller {
* Render default template
*/
public function index() {
Util::addScript(Application::APP_ID, 'notestutorial-main');
Util::addScript(Application::APP_ID, 'upschooling-main');
return new TemplateResponse(Application::APP_ID, 'main');
}

View file

@ -1,6 +1,6 @@
<?php
namespace OCA\NotesTutorial\Db;
namespace OCA\UPschooling\Db;
use JsonSerializable;

View file

@ -1,6 +1,6 @@
<?php
namespace OCA\NotesTutorial\Db;
namespace OCA\UPschooling\Db;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
@ -10,7 +10,7 @@ use OCP\IDBConnection;
class NoteMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'notestutorial', Note::class);
parent::__construct($db, 'upschooling', Note::class);
}
/**
@ -24,7 +24,7 @@ class NoteMapper extends QBMapper {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('notestutorial')
->from('upschooling')
->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
return $this->findEntity($qb);
@ -38,7 +38,7 @@ class NoteMapper extends QBMapper {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('notestutorial')
->from('upschooling')
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
return $this->findEntities($qb);
}

View file

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\NotesTutorial\Migration;
namespace OCA\UPschooling\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
@ -21,8 +21,8 @@ class Version000000Date20181013124731 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('notestutorial')) {
$table = $schema->createTable('notestutorial');
if (!$schema->hasTable('upschooling')) {
$table = $schema->createTable('upschooling');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
@ -41,7 +41,7 @@ class Version000000Date20181013124731 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['user_id'], 'notestutorial_user_id_index');
$table->addIndex(['user_id'], 'upschooling_user_id_index');
}
return $schema;
}

View file

@ -1,6 +1,6 @@
<?php
namespace OCA\NotesTutorial\Service;
namespace OCA\UPschooling\Service;
class NoteNotFound extends \Exception {
}

View file

@ -1,14 +1,14 @@
<?php
namespace OCA\NotesTutorial\Service;
namespace OCA\UPschooling\Service;
use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCA\NotesTutorial\Db\Note;
use OCA\NotesTutorial\Db\NoteMapper;
use OCA\UPschooling\Db\Note;
use OCA\UPschooling\Db\NoteMapper;
class NoteService {

4
package-lock.json generated
View file

@ -1,11 +1,11 @@
{
"name": "notestutorial",
"name": "upschooling",
"version": "19.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "notestutorial",
"name": "upschooling",
"version": "19.0.0",
"license": "agpl",
"dependencies": {

View file

@ -1,5 +1,5 @@
{
"name": "notestutorial",
"name": "upschooling",
"description": "A simple Nextcloud app tutorial for building a notes app",
"version": "19.0.0",
"author": "Julius Härtl <jus@bitgrid.net",

View file

@ -8,7 +8,7 @@ DIR="${0%/*}"
podman run -d --name=nextcloud --replace=true -p 8080:80 -v "$DIR:/var/www/html/custom_apps/upschooling" docker.io/nextcloud
podman exec nextcloud chown -R 33 /var/www/html/custom_apps
"$DIR/podman-reown.sh"
podman exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make'
podman exec --user 33 nextcloud bash -c 'cd /var/www/html/custom_apps/upschooling && make composer'
podman exec --user 33 nextcloud php occ maintenance:install --database sqlite --admin-user admin --admin-pass admin
podman exec --user 33 nextcloud php occ config:system:set --value=true --type=boolean debug
podman exec --user 33 nextcloud php occ app:enable --force upschooling

View file

@ -1,28 +1,28 @@
<template>
<div id="content" class="app-notestutorial">
<div id="content" class="app-upschooling">
<AppNavigation>
<AppNavigationNew v-if="!loading"
:text="t('notestutorial', 'New note')"
:text="t('upschooling', 'New note')"
:disabled="false"
button-id="new-notestutorial-button"
button-id="new-upschooling-button"
button-class="icon-add"
@click="newNote" />
<ul>
<AppNavigationItem v-for="note in notes"
:key="note.id"
:title="note.title ? note.title : t('notestutorial', 'New note')"
:title="note.title ? note.title : t('upschooling', 'New note')"
:class="{active: currentNoteId === note.id}"
@click="openNote(note)">
<template slot="actions">
<ActionButton v-if="note.id === -1"
icon="icon-close"
@click="cancelNewNote(note)">
{{ t('notestutorial', 'Cancel note creation') }}
{{ t('upschooling', 'Cancel note creation') }}
</ActionButton>
<ActionButton v-else
icon="icon-delete"
@click="deleteNote(note)">
{{ t('notestutorial', 'Delete note') }}
{{ t('upschooling', 'Delete note') }}
</ActionButton>
</template>
</AppNavigationItem>
@ -37,13 +37,13 @@
<textarea ref="content" v-model="currentNote.content" :disabled="updating" />
<input type="button"
class="primary"
:value="t('notestutorial', 'Save')"
:value="t('upschooling', 'Save')"
:disabled="updating || !savePossible"
@click="saveNote">
</div>
<div v-else id="emptycontent">
<div class="icon-file" />
<h2>{{ t('notestutorial', 'Create a note to get started') }}</h2>
<h2>{{ t('upschooling', 'Create a note to get started') }}</h2>
</div>
</AppContent>
</div>
@ -103,11 +103,11 @@ export default {
*/
async mounted() {
try {
const response = await axios.get(generateUrl('/apps/notestutorial/notes'))
const response = await axios.get(generateUrl('/apps/upschooling/notes'))
this.notes = response.data
} catch (e) {
console.error(e)
showError(t('notestutorial', 'Could not fetch notes'))
showError(t('upschooling', 'Could not fetch notes'))
}
this.loading = false
},
@ -169,13 +169,13 @@ export default {
async createNote(note) {
this.updating = true
try {
const response = await axios.post(generateUrl('/apps/notestutorial/notes'), note)
const response = await axios.post(generateUrl('/apps/upschooling/notes'), note)
const index = this.notes.findIndex((match) => match.id === this.currentNoteId)
this.$set(this.notes, index, response.data)
this.currentNoteId = response.data.id
} catch (e) {
console.error(e)
showError(t('notestutorial', 'Could not create the note'))
showError(t('upschooling', 'Could not create the note'))
}
this.updating = false
},
@ -186,10 +186,10 @@ export default {
async updateNote(note) {
this.updating = true
try {
await axios.put(generateUrl(`/apps/notestutorial/notes/${note.id}`), note)
await axios.put(generateUrl(`/apps/upschooling/notes/${note.id}`), note)
} catch (e) {
console.error(e)
showError(t('notestutorial', 'Could not update the note'))
showError(t('upschooling', 'Could not update the note'))
}
this.updating = false
},
@ -199,15 +199,15 @@ export default {
*/
async deleteNote(note) {
try {
await axios.delete(generateUrl(`/apps/notestutorial/notes/${note.id}`))
await axios.delete(generateUrl(`/apps/upschooling/notes/${note.id}`))
this.notes.splice(this.notes.indexOf(note), 1)
if (this.currentNoteId === note.id) {
this.currentNoteId = null
}
showSuccess(t('notestutorial', 'Note deleted'))
showSuccess(t('upschooling', 'Note deleted'))
} catch (e) {
console.error(e)
showError(t('notestutorial', 'Could not delete the note'))
showError(t('upschooling', 'Could not delete the note'))
}
},
},

View file

@ -1,15 +1,15 @@
<?php
namespace OCA\NotesTutorial\Tests\Integration\Controller;
namespace OCA\UPschooling\Tests\Integration\Controller;
use OCP\AppFramework\App;
use OCP\IRequest;
use PHPUnit\Framework\TestCase;
use OCA\NotesTutorial\Db\Note;
use OCA\NotesTutorial\Db\NoteMapper;
use OCA\NotesTutorial\Controller\NoteController;
use OCA\UPschooling\Db\Note;
use OCA\UPschooling\Db\NoteMapper;
use OCA\UPschooling\Controller\NoteController;
class NoteIntegrationTest extends TestCase {
private $controller;
@ -17,7 +17,7 @@ class NoteIntegrationTest extends TestCase {
private $userId = 'john';
public function setUp(): void {
$app = new App('notestutorial');
$app = new App('upschooling');
$container = $app->getContainer();
// only replace the user id

View file

@ -1,8 +1,8 @@
<?php
namespace OCA\NotesTutorial\Tests\Unit\Controller;
namespace OCA\UPschooling\Tests\Unit\Controller;
use OCA\NotesTutorial\Controller\NoteApiController;
use OCA\UPschooling\Controller\NoteApiController;
class NoteApiControllerTest extends NoteControllerTest {
public function setUp(): void {

View file

@ -1,15 +1,15 @@
<?php
namespace OCA\NotesTutorial\Tests\Unit\Controller;
namespace OCA\UPschooling\Tests\Unit\Controller;
use PHPUnit\Framework\TestCase;
use OCP\AppFramework\Http;
use OCP\IRequest;
use OCA\NotesTutorial\Service\NoteNotFound;
use OCA\NotesTutorial\Service\NoteService;
use OCA\NotesTutorial\Controller\NoteController;
use OCA\UPschooling\Service\NoteNotFound;
use OCA\UPschooling\Service\NoteService;
use OCA\UPschooling\Controller\NoteController;
class NoteControllerTest extends TestCase {
protected $controller;

View file

@ -1,6 +1,6 @@
<?php
namespace OCA\NotesTutorial\Controller;
namespace OCA\UPschooling\Controller;
use PHPUnit\Framework\TestCase;

View file

@ -1,15 +1,15 @@
<?php
namespace OCA\NotesTutorial\Tests\Unit\Service;
namespace OCA\UPschooling\Tests\Unit\Service;
use OCA\NotesTutorial\Service\NoteNotFound;
use OCA\UPschooling\Service\NoteNotFound;
use PHPUnit\Framework\TestCase;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\NotesTutorial\Db\Note;
use OCA\NotesTutorial\Service\NoteService;
use OCA\NotesTutorial\Db\NoteMapper;
use OCA\UPschooling\Db\Note;
use OCA\UPschooling\Service\NoteService;
use OCA\UPschooling\Db\NoteMapper;
class NoteServiceTest extends TestCase {
private $service;