mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-15 18:56:18 +00:00
Compare commits
13 Commits
161-simple
...
189-add-su
| Author | SHA1 | Date | |
|---|---|---|---|
|
f6098d554c
|
|||
|
6e565ee0df
|
|||
| eef0829528 | |||
|
f828f6fc13
|
|||
|
b67a0a9c5a
|
|||
|
40d72fa0cc
|
|||
| 63a38e0077 | |||
| c8b260201c | |||
|
123c50d1af
|
|||
|
|
d65e6351e9 | ||
|
|
2c5d7403db | ||
|
6ca03f463d
|
|||
|
|
1f74a9bc82 |
5
.changeset/good-eggs-add.md
Normal file
5
.changeset/good-eggs-add.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openstapps/prettier-config": patch
|
||||
---
|
||||
|
||||
Update Prettier to 3.1.1
|
||||
6
.changeset/nine-bears-speak.md
Normal file
6
.changeset/nine-bears-speak.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@openstapps/backend": minor
|
||||
"@openstapps/core": minor
|
||||
---
|
||||
|
||||
Add the ability to filter by existence of a field
|
||||
5
.changeset/old-bottles-hide.md
Normal file
5
.changeset/old-bottles-hide.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openstapps/backend": patch
|
||||
---
|
||||
|
||||
Backend unit tests break every year
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,6 +24,7 @@ report-junit.xml
|
||||
# NixOS flake
|
||||
result
|
||||
hsperfdata_root
|
||||
.direnv/
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/** @type {import('syncpack').RcFile} */
|
||||
const config = {
|
||||
semverRange: '',
|
||||
semverGroups: [{range: ''}],
|
||||
source: ['package.json', '**/package.json'],
|
||||
indent: ' ',
|
||||
sortFirst: [
|
||||
@@ -49,7 +49,7 @@ const config = {
|
||||
{
|
||||
label: 'Packages should use workspace version',
|
||||
dependencies: ['@openstapps/**'],
|
||||
dependencyTypes: ['prod', 'dev'],
|
||||
dependencyTypes: ['prod', 'dev', 'peer'],
|
||||
packages: ['**'],
|
||||
pinVersion: 'workspace:*',
|
||||
},
|
||||
|
||||
3
.tool-versions
Normal file
3
.tool-versions
Normal file
@@ -0,0 +1,3 @@
|
||||
nodejs 18.16.1
|
||||
pnpm 8.8.0
|
||||
python 3.11.5
|
||||
@@ -1,5 +1,3 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* This is the database configuration for the technical university of berlin
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
|
||||
|
||||
/** @type {import('@openstapps/core').SCLanguageSetting} */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
/** @type {import('@openstapps/core').SCAppConfigurationMenuCategory[]} */
|
||||
const menus = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
|
||||
|
||||
/** @type {import('@openstapps/core').SCUserGroupSetting} */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCThingType} from '@openstapps/core';
|
||||
|
||||
/** @type {import('@openstapps/core').SCBackendAggregationConfiguration[]} */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {
|
||||
month,
|
||||
sommerRange,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCThingType} from '@openstapps/core';
|
||||
import aggregations from './aggregations.js';
|
||||
import boostings from './boostings.js';
|
||||
@@ -17,7 +16,7 @@ export const backend = {
|
||||
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
|
||||
mappingIgnoredTags: ['minlength', 'pattern', 'see', 'tjs-format'],
|
||||
maxMultiSearchRouteQueries: 5,
|
||||
maxRequestBodySize: 2 * 10 ** 6,
|
||||
maxRequestBodySize: 2e6,
|
||||
name: 'Goethe-Universität Frankfurt am Main',
|
||||
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
||||
sortableFields: [
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import app from './app/index.js';
|
||||
import {backend, internal} from './backend/index.js';
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* This is the default configuration for elasticsearch (a database)
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {readFile} from 'fs/promises';
|
||||
import {SCAboutPageContentType} from '@openstapps/core';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
/**
|
||||
* Generates a range of numbers that represent consecutive calendar months
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {readFile, readdir} from 'fs/promises';
|
||||
import url from 'url';
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCAboutPageContentType} from '@openstapps/core';
|
||||
import {markdown} from '../../default/tools/markdown.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {SCAboutPageContentType} from '@openstapps/core';
|
||||
|
||||
/** @type {import('@openstapps/core').SCAboutPage} */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import about from './about.js';
|
||||
import imprint from './imprint.js';
|
||||
import privacy from './privacy.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {markdown} from '../../default/tools/markdown.js';
|
||||
|
||||
/** @type {import('@openstapps/core').SCAboutPage} */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import aboutPages from './about-pages/index.js';
|
||||
import defaultApp from '../default/app/index.js';
|
||||
import {backend as defaultBackend, internal as defaultInternal} from '../default/backend/index.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
import {versions} from '../../default/tools/version.js';
|
||||
|
||||
/** @type {import('@openstapps/core').SCAppVersionInfo[]} */
|
||||
|
||||
@@ -21,16 +21,31 @@ import {QueryDslSpecificQueryContainer} from '../../types/util.js';
|
||||
*/
|
||||
export function buildValueFilter(
|
||||
filter: SCSearchValueFilter,
|
||||
): QueryDslSpecificQueryContainer<'term'> | QueryDslSpecificQueryContainer<'terms'> {
|
||||
return Array.isArray(filter.arguments.value)
|
||||
? {
|
||||
terms: {
|
||||
[`${filter.arguments.field}.raw`]: filter.arguments.value,
|
||||
):
|
||||
| QueryDslSpecificQueryContainer<'exists'>
|
||||
| QueryDslSpecificQueryContainer<'term'>
|
||||
| QueryDslSpecificQueryContainer<'terms'> {
|
||||
switch (typeof filter.arguments.value) {
|
||||
case 'undefined': {
|
||||
return {
|
||||
exists: {
|
||||
field: filter.arguments.field,
|
||||
},
|
||||
}
|
||||
: {
|
||||
};
|
||||
}
|
||||
case 'string': {
|
||||
return {
|
||||
term: {
|
||||
[`${filter.arguments.field}.raw`]: filter.arguments.value,
|
||||
},
|
||||
};
|
||||
}
|
||||
case 'object': {
|
||||
return {
|
||||
terms: {
|
||||
[`${filter.arguments.field}.raw`]: filter.arguments.value,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SCBook,
|
||||
SCBulkAddRoute,
|
||||
SCBulkDoneRoute,
|
||||
SCBulkRequest,
|
||||
@@ -23,29 +24,30 @@ import {
|
||||
import {expect} from 'chai';
|
||||
import {bulk, DEFAULT_TEST_TIMEOUT} from '../common.js';
|
||||
import {testApp} from '../tests-setup.js';
|
||||
import {readFile} from 'fs/promises';
|
||||
import {v4} from 'uuid';
|
||||
import bookFile from '@openstapps/core/test/resources/indexable/Book.2.json' assert {type: 'json'};
|
||||
|
||||
const book = JSON.parse(
|
||||
await readFile('node_modules/@openstapps/core/test/resources/indexable/Book.2.json', 'utf8'),
|
||||
).instance;
|
||||
const book = bookFile.instance as SCBook;
|
||||
|
||||
describe('Bulk routes', async function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
|
||||
const request: SCBulkRequest = {
|
||||
expiration: bulk.expiration,
|
||||
source: bulk.source,
|
||||
type: bulk.type,
|
||||
};
|
||||
const bulkRoute = new SCBulkRoute();
|
||||
const bulkAddRoute = new SCBulkAddRoute();
|
||||
const bulkDoneRoute = new SCBulkDoneRoute();
|
||||
let request: SCBulkRequest;
|
||||
let bulkRoute: SCBulkRoute;
|
||||
let bulkAddRoute: SCBulkAddRoute;
|
||||
let bulkDoneRoute: SCBulkDoneRoute;
|
||||
|
||||
// afterEach(async function() {
|
||||
// TODO: Delete saved bulks
|
||||
// });
|
||||
before(function () {
|
||||
request = {
|
||||
expiration: bulk.expiration,
|
||||
source: bulk.source,
|
||||
type: bulk.type,
|
||||
};
|
||||
bulkRoute = new SCBulkRoute();
|
||||
bulkAddRoute = new SCBulkAddRoute();
|
||||
bulkDoneRoute = new SCBulkDoneRoute();
|
||||
});
|
||||
|
||||
it('should create bulk', async function () {
|
||||
const {status, body, error} = await testApp
|
||||
|
||||
@@ -21,7 +21,12 @@ import {expect} from 'chai';
|
||||
describe('Index route', async function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
const indexRoute = new SCIndexRoute();
|
||||
|
||||
let indexRoute: SCIndexRoute;
|
||||
|
||||
before(function () {
|
||||
indexRoute = new SCIndexRoute();
|
||||
});
|
||||
|
||||
it('should respond with both app and backend configuration', async function () {
|
||||
const request: SCIndexRequest = {};
|
||||
|
||||
@@ -30,15 +30,11 @@ import chaiAsPromised from 'chai-as-promised';
|
||||
import {DEFAULT_TEST_TIMEOUT} from '../common.js';
|
||||
import {testApp} from '../tests-setup.js';
|
||||
import {backendConfig} from '../../src/config.js';
|
||||
import {readFile} from 'fs/promises';
|
||||
import registerRequest from '@openstapps/core/test/resources/PluginRegisterRequest.1.json' assert {type: 'json'};
|
||||
|
||||
// for using promises in expectations (to.eventually.be...)
|
||||
use(chaiAsPromised);
|
||||
|
||||
const registerRequest = JSON.parse(
|
||||
await readFile('node_modules/@openstapps/core/test/resources/PluginRegisterRequest.1.json', 'utf8'),
|
||||
);
|
||||
|
||||
// cast it because of "TS2322: Type 'string' is not assignable to type '"add"'"
|
||||
export const registerAddRequest: SCPluginAdd = registerRequest.instance as SCPluginAdd;
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ describe('Create route', async function () {
|
||||
const statusCodeSuccess = 222;
|
||||
const bodySuccess = {foo: true};
|
||||
const sandbox = sinon.createSandbox();
|
||||
const validationError = new SCValidationErrorResponse([]);
|
||||
const internalServerError = new SCInternalServerErrorResponse();
|
||||
let validationError: SCValidationErrorResponse;
|
||||
let internalServerError: SCInternalServerErrorResponse;
|
||||
|
||||
beforeEach(function () {
|
||||
app = express();
|
||||
@@ -64,6 +64,9 @@ describe('Create route', async function () {
|
||||
handler = (_request, _app) => {
|
||||
return Promise.resolve(bodySuccess);
|
||||
};
|
||||
|
||||
validationError = new SCValidationErrorResponse([]);
|
||||
internalServerError = new SCInternalServerErrorResponse();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
|
||||
@@ -29,11 +29,19 @@ import {backendConfig} from '../../src/config.js';
|
||||
describe('Search route', async function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
const searchRoute = new SCSearchRoute();
|
||||
const multiSearchRoute = new SCMultiSearchRoute();
|
||||
const syntaxError = new SCSyntaxErrorResponse('Foo Message');
|
||||
const methodNotAllowedError = new SCMethodNotAllowedErrorResponse();
|
||||
const tooManyRequestsError = new SCTooManyRequestsErrorResponse();
|
||||
let searchRoute: SCSearchRoute;
|
||||
let multiSearchRoute: SCMultiSearchRoute;
|
||||
let syntaxError: SCSyntaxErrorResponse;
|
||||
let methodNotAllowedError: SCMethodNotAllowedErrorResponse;
|
||||
let tooManyRequestsError: SCTooManyRequestsErrorResponse;
|
||||
|
||||
before(function () {
|
||||
searchRoute = new SCSearchRoute();
|
||||
multiSearchRoute = new SCMultiSearchRoute();
|
||||
syntaxError = new SCSyntaxErrorResponse('Foo Message');
|
||||
methodNotAllowedError = new SCMethodNotAllowedErrorResponse();
|
||||
tooManyRequestsError = new SCTooManyRequestsErrorResponse();
|
||||
});
|
||||
|
||||
it('should reject GET, PUT with a valid search query', async function () {
|
||||
// const expectedParams = JSON.parse(JSON.stringify(defaultParams));
|
||||
|
||||
@@ -13,23 +13,25 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingUpdateRoute} from '@openstapps/core';
|
||||
import {SCBook, SCThingUpdateRoute} from '@openstapps/core';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import {bulkStorageMock, DEFAULT_TEST_TIMEOUT} from '../common.js';
|
||||
import {expect, use} from 'chai';
|
||||
import {testApp} from '../tests-setup.js';
|
||||
import {readFile} from 'fs/promises';
|
||||
import bookFile from '@openstapps/core/test/resources/indexable/Book.1.json' assert {type: 'json'};
|
||||
|
||||
use(chaiAsPromised);
|
||||
|
||||
const book = JSON.parse(
|
||||
await readFile('node_modules/@openstapps/core/test/resources/indexable/Book.1.json', 'utf8'),
|
||||
).instance;
|
||||
const book = bookFile.instance as SCBook;
|
||||
|
||||
describe('Thing update route', async function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
const thingUpdateRoute = new SCThingUpdateRoute();
|
||||
let thingUpdateRoute: SCThingUpdateRoute;
|
||||
|
||||
before(function () {
|
||||
thingUpdateRoute = new SCThingUpdateRoute();
|
||||
});
|
||||
|
||||
it('should update a thing', async function () {
|
||||
const thingUpdateRouteurlPath = thingUpdateRoute.urlPath
|
||||
|
||||
@@ -39,7 +39,6 @@ import {Elasticsearch} from '../../../src/storage/elasticsearch/elasticsearch.js
|
||||
import {bulk, DEFAULT_TEST_TIMEOUT, getTransport, getIndex} from '../../common.js';
|
||||
import fs from 'fs';
|
||||
import {backendConfig} from '../../../src/config.js';
|
||||
import {readFile} from 'fs/promises';
|
||||
import {
|
||||
ACTIVE_INDICES_ALIAS,
|
||||
getIndexUID,
|
||||
@@ -50,6 +49,11 @@ import {
|
||||
} from '../../../src/storage/elasticsearch/util/index.js';
|
||||
import cron from 'node-cron';
|
||||
import {query} from './query.js';
|
||||
import messageFile from '@openstapps/core/test/resources/indexable/Message.1.json' assert {type: 'json'};
|
||||
import bookFile from '@openstapps/core/test/resources/indexable/Book.1.json' assert {type: 'json'};
|
||||
|
||||
const message = messageFile.instance as SCMessage;
|
||||
const book = bookFile.instance as SCBook;
|
||||
|
||||
use(chaiAsPromised);
|
||||
|
||||
@@ -60,13 +64,6 @@ function searchResponse<T>(...hits: SearchHit<T>[]): SearchResponse<T> {
|
||||
return {hits: {hits}, took: 0, timed_out: false, _shards: {total: 1, failed: 0, successful: 1}};
|
||||
}
|
||||
|
||||
const message = JSON.parse(
|
||||
await readFile('node_modules/@openstapps/core/test/resources/indexable/Message.1.json', 'utf8'),
|
||||
);
|
||||
const book = JSON.parse(
|
||||
await readFile('node_modules/@openstapps/core/test/resources/indexable/Book.1.json', 'utf8'),
|
||||
);
|
||||
|
||||
describe('Elasticsearch', function () {
|
||||
// increase timeout for the suite
|
||||
this.timeout(DEFAULT_TEST_TIMEOUT);
|
||||
@@ -74,8 +71,15 @@ describe('Elasticsearch', function () {
|
||||
|
||||
before(function () {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('before');
|
||||
sandbox.stub(fs, 'readFileSync').returns('{}');
|
||||
sandbox.stub(backendConfig.internal.boostings.default[0], 'fields').value({
|
||||
'academicTerms.acronym': {
|
||||
'SS 2023': 1.05,
|
||||
'WS 2023/24': 1.1,
|
||||
'SoSe 2023': 1.05,
|
||||
'WiSe 2023/24': 1.1,
|
||||
},
|
||||
});
|
||||
});
|
||||
after(function () {
|
||||
sandbox.restore();
|
||||
@@ -445,7 +449,7 @@ describe('Elasticsearch', function () {
|
||||
_id: '',
|
||||
_index: '',
|
||||
_score: 0,
|
||||
_source: message as SCMessage,
|
||||
_source: message,
|
||||
};
|
||||
sandbox.stub(es.client, 'search').resolves(searchResponse(foundObject));
|
||||
|
||||
@@ -475,7 +479,7 @@ describe('Elasticsearch', function () {
|
||||
const object: SearchHit<SCMessage> = {
|
||||
_id: '',
|
||||
_index: oldIndex,
|
||||
_source: message as SCMessage,
|
||||
_source: message,
|
||||
};
|
||||
sandbox.stub(es.client, 'search').resolves(searchResponse<SCMessage>(object));
|
||||
sandbox.stub(es, 'prepareBulkWrite').resolves(index);
|
||||
@@ -489,7 +493,7 @@ describe('Elasticsearch', function () {
|
||||
sandbox.stub(es.client, 'create').resolves({result: 'not_found'} as CreateResponse);
|
||||
|
||||
await es.init();
|
||||
return expect(es.post(message as SCMessage, bulk)).to.rejectedWith('creation');
|
||||
return expect(es.post(message, bulk)).to.rejectedWith('creation');
|
||||
});
|
||||
|
||||
it('should create a new object', async function () {
|
||||
@@ -502,7 +506,7 @@ describe('Elasticsearch', function () {
|
||||
});
|
||||
|
||||
await es.init();
|
||||
await es.post(message as SCMessage, bulk);
|
||||
await es.post(message, bulk);
|
||||
|
||||
expect(createStub.called).to.be.true;
|
||||
expect(caughtParameter.document).to.be.eql({
|
||||
@@ -527,7 +531,7 @@ describe('Elasticsearch', function () {
|
||||
_id: '',
|
||||
_index: getIndex(),
|
||||
_score: 0,
|
||||
_source: message as SCMessage,
|
||||
_source: message,
|
||||
};
|
||||
sandbox.stub(es.client, 'search').resolves(searchResponse());
|
||||
|
||||
@@ -541,7 +545,7 @@ describe('Elasticsearch', function () {
|
||||
_id: '',
|
||||
_index: getIndex(),
|
||||
_score: 0,
|
||||
_source: message as SCMessage,
|
||||
_source: message,
|
||||
};
|
||||
sandbox.stub(es.client, 'search').resolves(searchResponse(object));
|
||||
// @ts-expect-error unused
|
||||
@@ -564,13 +568,13 @@ describe('Elasticsearch', function () {
|
||||
_id: '123',
|
||||
_index: getIndex(),
|
||||
_score: 0,
|
||||
_source: message as SCMessage,
|
||||
_source: message,
|
||||
};
|
||||
const objectBook: SearchHit<SCBook> = {
|
||||
_id: '321',
|
||||
_index: getIndex(),
|
||||
_score: 0,
|
||||
_source: book as SCBook,
|
||||
_source: book,
|
||||
};
|
||||
const fakeEsAggregations = {
|
||||
'@all': {
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"allowJs": true,
|
||||
"checkJs": true
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"exclude": ["app.js", "lib/"]
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"name": "@openstapps/database",
|
||||
"version": "3.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "docker run -it -p 9200:9200 $(docker build -q .)"
|
||||
},
|
||||
"files": [
|
||||
"config",
|
||||
"Dockerfile",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["./config/", "./lib/"]
|
||||
"exclude": ["config", "lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
const fs = require("fs");
|
||||
const path = require("node:path");
|
||||
const child_process = require("child_process");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
"use strict"
|
||||
|
||||
const rule = require('./copyright-header-rule')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
const config = {
|
||||
root: true,
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
"test": "prettier --config index.js --check \"test/*.js\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "3.1.0"
|
||||
"prettier": "3.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"prettier": "3.1.0"
|
||||
"prettier": "3.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"isolatedModules": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noImplicitAny": true,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,44 +1,62 @@
|
||||
version: '3.7'
|
||||
|
||||
x-development-variables: &development-variables
|
||||
NODE_ENV: "development"
|
||||
ALLOW_NO_TRANSPORT: "true"
|
||||
|
||||
services:
|
||||
database:
|
||||
image: registry.gitlab.com/openstapps/openstapps/database:2.0.0
|
||||
volumes:
|
||||
- ./database:/usr/share/elasticsearch/data
|
||||
image: registry.gitlab.com/openstapps/openstapps/database:3.0.0
|
||||
# If you need persistence for debugging purposes uncomment the following lines
|
||||
#volumes:
|
||||
# - ./database:/usr/share/elasticsearch/data
|
||||
expose:
|
||||
- "9200"
|
||||
- 9200
|
||||
ports:
|
||||
- 127.0.0.1:9200:9200
|
||||
environment:
|
||||
- bootstrap.memory_lock=true
|
||||
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
|
||||
- discovery.type=single-node
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
restart: unless-stopped
|
||||
|
||||
backend:
|
||||
image: registry.gitlab.com/openstapps/openstapps/backend:3.0.0-next.0
|
||||
image: registry.gitlab.com/openstapps/openstapps/backend:3.1.0
|
||||
environment:
|
||||
<<: *development-variables
|
||||
ES_ADDR: "http://database:9200"
|
||||
NODE_CONFIG_ENV: "elasticsearch"
|
||||
ALLOW_NO_TRANSPORT: "true"
|
||||
NODE_APP_INSTANCE: "f-u"
|
||||
PROMETHEUS_MIDDLEWARE: "false"
|
||||
expose:
|
||||
- 3000
|
||||
ports:
|
||||
- 3000:3000
|
||||
links:
|
||||
- "database"
|
||||
- 127.0.0.1:3000:3000
|
||||
labels:
|
||||
- stapps.version=1.0.0
|
||||
- stapps.version=4.1.0
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- database
|
||||
|
||||
api:
|
||||
image: registry.gitlab.com/openstapps/openstapps/api:3.0.0-next.0
|
||||
links:
|
||||
- "backend"
|
||||
- database
|
||||
|
||||
minimal-connector:
|
||||
image: registry.gitlab.com/openstapps/minimal-connector:core-0.23
|
||||
container_name: minimal-connector-0.23
|
||||
command: ["http://backend:3000", "minimal-connector", "f-u"]
|
||||
# api:
|
||||
# image: registry.gitlab.com/openstapps/openstapps/api:3.0.0
|
||||
# links:
|
||||
# - backend
|
||||
|
||||
app:
|
||||
image: registry.gitlab.com/openstapps/app/executable:core-0.23
|
||||
expose:
|
||||
- 8100
|
||||
ports:
|
||||
- 8100:8100
|
||||
# minimal-connector:
|
||||
# image: registry.gitlab.com/openstapps/minimal-connector:core-0.23
|
||||
# container_name: minimal-connector-0.23
|
||||
# command: ["http://backend:3000", "minimal-connector", "f-u"]
|
||||
|
||||
# app:
|
||||
# image: registry.gitlab.com/openstapps/app/executable:core-0.23
|
||||
# expose:
|
||||
# - 8100
|
||||
# ports:
|
||||
# - 8100:8100
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
34
flake.lock
generated
34
flake.lock
generated
@@ -1,5 +1,23 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1701626906,
|
||||
@@ -18,8 +36,24 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
142
flake.nix
142
flake.nix
@@ -1,77 +1,75 @@
|
||||
{
|
||||
description = "A Nix-flake-based development environment for OpenStApps";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
buildToolsVersion = "30.0.3";
|
||||
overlays = [
|
||||
(final: prev: rec {
|
||||
nodejs = prev.nodejs-18_x;
|
||||
pnpm = prev.nodePackages.pnpm;
|
||||
chrome = prev.google-chrome;
|
||||
firefox = prev.firefox;
|
||||
webkit = prev.epiphany; # Safari-ish browser
|
||||
android = prev.androidenv.composeAndroidPackages {
|
||||
buildToolsVersions = [ "${buildToolsVersion}" ];
|
||||
platformVersions = [ "33" ];
|
||||
};
|
||||
cypress = prev.cypress.overrideAttrs(cyPrev: rec {
|
||||
version = "13.2.0";
|
||||
src = prev.fetchzip {
|
||||
url = "https://cdn.cypress.io/desktop/${version}/linux-x64/cypress.zip";
|
||||
hash = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM=";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}: let
|
||||
aapt2buildToolsVersion = "33.0.2";
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(final: prev: rec {
|
||||
fontMin = prev.python311.withPackages (ps: with ps; [brotli fonttools] ++ (with fonttools.optional-dependencies; [woff]));
|
||||
android = prev.androidenv.composeAndroidPackages {
|
||||
buildToolsVersions = ["30.0.3" aapt2buildToolsVersion];
|
||||
platformVersions = ["33"];
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
# TODO: aarch64-linux, x68_64-darwin, aarch64-darwin
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
pkgs = import nixpkgs {
|
||||
inherit overlays system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
android_sdk.accept_license = true;
|
||||
};
|
||||
cypress = prev.cypress.overrideAttrs (cyPrev: rec {
|
||||
version = "13.2.0";
|
||||
src = prev.fetchzip {
|
||||
url = "https://cdn.cypress.io/desktop/${version}/linux-x64/cypress.zip";
|
||||
hash = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM=";
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
android_sdk.accept_license = true;
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
devShells = forEachSupportedSystem ({ pkgs }:
|
||||
let
|
||||
python = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ ufo lxml unicode woff ])));
|
||||
in
|
||||
{
|
||||
default = (pkgs.buildFHSUserEnv {
|
||||
name = "StApps Dev";
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
nodejs
|
||||
pnpm
|
||||
python
|
||||
docker
|
||||
# tools
|
||||
curl
|
||||
jq
|
||||
# browsers
|
||||
firefox
|
||||
chrome
|
||||
webkit
|
||||
cypress
|
||||
# android
|
||||
jdk17
|
||||
android.androidsdk
|
||||
musl
|
||||
];
|
||||
runScript = "bash";
|
||||
profile = ''
|
||||
export CYPRESS_INSTALL_BINARY=0
|
||||
export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
|
||||
export ANDROID_SDK_ROOT=${pkgs.android.androidsdk}/libexec/android-sdk
|
||||
export ANDROID_JAVA_HOME=${pkgs.jdk.home}
|
||||
export DOCKER_HOST=unix:///run/user/1000/docker.sock
|
||||
{ dockerd-rootless & } 2>/dev/null
|
||||
'';
|
||||
}).env;
|
||||
});
|
||||
};
|
||||
};
|
||||
androidFhs = pkgs.buildFHSUserEnv {
|
||||
name = "android-env";
|
||||
targetPkgs = pkgs: with pkgs; [];
|
||||
runScript = "bash";
|
||||
profile = ''
|
||||
export ALLOW_NINJA_ENV=true
|
||||
export USE_CCACHE=1
|
||||
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32
|
||||
'';
|
||||
};
|
||||
in {
|
||||
devShell = pkgs.mkShell rec {
|
||||
nativeBuildInputs = [androidFhs];
|
||||
buildInputs = with pkgs; [
|
||||
nodejs-18_x
|
||||
nodePackages.pnpm
|
||||
# tools
|
||||
curl
|
||||
jq
|
||||
fontMin
|
||||
# browsers
|
||||
firefox
|
||||
google-chrome
|
||||
epiphany # Safari-ish browser
|
||||
cypress
|
||||
# android
|
||||
jdk17
|
||||
android.androidsdk
|
||||
musl
|
||||
];
|
||||
ANDROID_JAVA_HOME = "${pkgs.jdk.home}";
|
||||
ANDROID_SDK_ROOT = "${pkgs.android.androidsdk}/libexec/android-sdk";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${aapt2buildToolsVersion}/aapt2";
|
||||
CYPRESS_INSTALL_BINARY = "0";
|
||||
CYPRESS_RUN_BINARY = "${pkgs.cypress}/bin/Cypress";
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ def capacitor_pods
|
||||
pod 'CapacitorPreferences', :path => '../../../../node_modules/.pnpm/@capacitor+preferences@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/preferences'
|
||||
pod 'CapacitorShare', :path => '../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share'
|
||||
pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen'
|
||||
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch'
|
||||
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch'
|
||||
pod 'CapacitorSecureStoragePlugin', :path => '../../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.9.0_@capacitor+core@5.5.0/node_modules/capacitor-secure-storage-plugin'
|
||||
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ PODS:
|
||||
- CordovaPlugins (5.5.0):
|
||||
- CapacitorCordova
|
||||
- SwiftKeychainWrapper (4.0.1)
|
||||
- TransistorsoftCapacitorBackgroundFetch (1.0.2):
|
||||
- TransistorsoftCapacitorBackgroundFetch (5.1.1):
|
||||
- Capacitor
|
||||
|
||||
DEPENDENCIES:
|
||||
@@ -58,7 +58,7 @@ DEPENDENCIES:
|
||||
- "CapacitorShare (from `../../../../node_modules/.pnpm/@capacitor+share@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/share`)"
|
||||
- "CapacitorSplashScreen (from `../../../../node_modules/.pnpm/@capacitor+splash-screen@5.0.6_@capacitor+core@5.5.0/node_modules/@capacitor/splash-screen`)"
|
||||
- CordovaPlugins (from `../capacitor-cordova-ios-plugins`)
|
||||
- "TransistorsoftCapacitorBackgroundFetch (from `../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch`)"
|
||||
- "TransistorsoftCapacitorBackgroundFetch (from `../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch`)"
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
@@ -102,7 +102,7 @@ EXTERNAL SOURCES:
|
||||
CordovaPlugins:
|
||||
:path: "../capacitor-cordova-ios-plugins"
|
||||
TransistorsoftCapacitorBackgroundFetch:
|
||||
:path: "../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch"
|
||||
:path: "../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@5.1.1_@capacitor+core@5.5.0/node_modules/@transistorsoft/capacitor-background-fetch"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Capacitor: 57890b363df14d5d2d5d8461aa23e886cb34da2a
|
||||
@@ -124,8 +124,8 @@ SPEC CHECKSUMS:
|
||||
CapacitorSplashScreen: 5fa2ab5e46cf5cc530cf16a51c80c7a986579ccd
|
||||
CordovaPlugins: de5669381702d76ed5b1d442177a6a5fc3252a9d
|
||||
SwiftKeychainWrapper: 807ba1d63c33a7d0613288512399cd1eda1e470c
|
||||
TransistorsoftCapacitorBackgroundFetch: 74ca62dae7ec78639eaf3d0d1e24c595ada213dd
|
||||
TransistorsoftCapacitorBackgroundFetch: ce4b3e01b898cef516e68485d2160a078016ee97
|
||||
|
||||
PODFILE CHECKSUM: 073b899f90bacc5049101cb9c562a168757d554e
|
||||
PODFILE CHECKSUM: 229278f2c257e8ab555325c7115b2e187e8e628d
|
||||
|
||||
COCOAPODS: 1.13.0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-check
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
SCThingOriginType,
|
||||
SCThingType,
|
||||
} from '@openstapps/core';
|
||||
import packageInfo from '@openstapps/core/package.json';
|
||||
import {CORE_VERSION} from '@openstapps/core';
|
||||
import {Polygon} from 'geojson';
|
||||
|
||||
// provides sample aggregations to be used in tests or backendless development
|
||||
@@ -195,7 +195,7 @@ export const sampleIndexResponse: SCIndexResponse = {
|
||||
},
|
||||
auth: {},
|
||||
backend: {
|
||||
SCVersion: packageInfo.version,
|
||||
SCVersion: CORE_VERSION,
|
||||
externalRequestTimeout: 5000,
|
||||
hiddenTypes: [SCThingType.DateSeries, SCThingType.Diff, SCThingType.Floor],
|
||||
mappingIgnoredTags: [],
|
||||
|
||||
@@ -70,6 +70,7 @@ import {setDefaultOptions} from 'date-fns';
|
||||
import {DateFnsConfigurationService} from 'ngx-date-fns';
|
||||
import {Capacitor} from '@capacitor/core';
|
||||
import {SplashScreen} from '@capacitor/splash-screen';
|
||||
import {SportCoursesModule} from './modules/sport-courses/sport-courses.module';
|
||||
|
||||
registerLocaleData(localeDe);
|
||||
|
||||
@@ -170,6 +171,7 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
ScheduleModule,
|
||||
SettingsModule,
|
||||
StorageModule,
|
||||
SportCoursesModule,
|
||||
ThingTranslateModule.forRoot(),
|
||||
TranslateModule.forRoot({
|
||||
defaultLanguage: 'en',
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Client} from '@openstapps/api';
|
||||
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
|
||||
import packageInfo from '@openstapps/core/package.json';
|
||||
import {CORE_VERSION} from '@openstapps/core';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
import {environment} from '../../../environments/environment';
|
||||
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
|
||||
@@ -55,7 +55,7 @@ export class ConfigProvider {
|
||||
/**
|
||||
* Version of the @openstapps/core package that app is using
|
||||
*/
|
||||
scVersion = packageInfo.version;
|
||||
scVersion = CORE_VERSION;
|
||||
|
||||
/**
|
||||
* First session indicator (config not found in storage)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCDateSeries, SCThingType, SCThings} from '@openstapps/core';
|
||||
import {SCThingType, SCThings} from '@openstapps/core';
|
||||
|
||||
/**
|
||||
* Shows a horizontal list of action chips
|
||||
@@ -47,9 +47,7 @@ export class ActionChipListComponent {
|
||||
const isNullIsland = maybeCoords ? maybeCoords[0] === 0 && maybeCoords[1] === 0 : false;
|
||||
this.applicable = {
|
||||
locate: false, // TODO: reimplement this at a later date
|
||||
event:
|
||||
item.type === SCThingType.AcademicEvent ||
|
||||
(item.type === SCThingType.DateSeries && (item as SCDateSeries).dates.length > 0),
|
||||
event: item.type === SCThingType.AcademicEvent || item.type === SCThingType.SportCourse,
|
||||
navigate: (hasDirectGeo || isInPlace) && !isNullIsland,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export const DataIcons: Record<SCThingType, string> = {
|
||||
'room': SCIcon`meeting_room`,
|
||||
'semester': SCIcon`date_range`,
|
||||
'setting': SCIcon`settings`,
|
||||
'sport course': SCIcon`sports_soccer`,
|
||||
'sport course': SCIcon`sports_gymnastics`,
|
||||
'study module': SCIcon`view_module`,
|
||||
'ticket': SCIcon`confirmation_number`,
|
||||
'todo': SCIcon`task`,
|
||||
|
||||
@@ -107,6 +107,8 @@ import {SemesterListItemComponent} from './types/semester/semester-list-item.com
|
||||
import {VideoDetailContentComponent} from './types/video/video-detail-content.component';
|
||||
import {VideoListItemComponent} from './types/video/video-list-item.component';
|
||||
import {ShareButtonComponent} from './elements/share-button.component';
|
||||
import {SanitizeHtmlPipe} from '../../util/sanitize-html.pipe';
|
||||
import {BypassTrustUrlPipe} from '../../util/bypass-trust-url.pipe';
|
||||
|
||||
/**
|
||||
* Module for handling data
|
||||
@@ -193,6 +195,8 @@ import {ShareButtonComponent} from './elements/share-button.component';
|
||||
MarkdownModule.forRoot(),
|
||||
MenuModule,
|
||||
IonIconModule,
|
||||
SanitizeHtmlPipe,
|
||||
BypassTrustUrlPipe,
|
||||
MomentModule.forRoot({
|
||||
relativeTimeThresholdOptions: {
|
||||
m: 59,
|
||||
|
||||
@@ -13,12 +13,23 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '@openstapps/core';
|
||||
import {SCAcademicPriceGroup, SCThingThatCanBeOffered, SCThingType, SCThings} from '@openstapps/core';
|
||||
import {SimpleBrowser} from 'src/app/util/browser.factory';
|
||||
|
||||
type WithRequired<T, K extends keyof T> = T & {[P in K]-?: T[P]};
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-offers-detail',
|
||||
templateUrl: 'offers-detail.html',
|
||||
})
|
||||
export class OffersDetailComponent {
|
||||
@Input() offers: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||
@Input() item: SCThings & WithRequired<SCThingThatCanBeOffered<SCAcademicPriceGroup>, 'offers'>;
|
||||
|
||||
constructor(readonly browser: SimpleBrowser) {}
|
||||
|
||||
async submit(id: string) {
|
||||
if (this.item.type === SCThingType.DateSeries && this.item.event.type === SCThingType.SportCourse) {
|
||||
this.browser.open(`${this.item.event.sameAs}#${id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ion-card>
|
||||
<ion-card-header>{{ 'data.detail.offers.TITLE' | translate | titlecase }}</ion-card-header>
|
||||
<ion-card-content>
|
||||
<div *ngFor="let offer of offers">
|
||||
<div *ngFor="let offer of item.offers">
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col *ngIf="offer.inPlace">
|
||||
@@ -45,16 +45,24 @@
|
||||
</ng-container>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<ion-grid *ngIf="offer.availability === 'out of stock'">
|
||||
<ion-row>
|
||||
<ion-col></ion-col>
|
||||
<ion-col width-20 text-right>
|
||||
<ion-text color="danger">
|
||||
<p>{{ 'data.detail.offers.sold_out' | translate }}</p>
|
||||
</ion-text>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<ion-button
|
||||
*ngIf="item.identifiers?.zfh as id; else availability"
|
||||
(click)="submit(id)"
|
||||
[color]="offer.availability === 'out of stock' ? 'danger' : offer.availability === 'limited availability' ? 'warning' : 'primary'"
|
||||
>{{'data.detail.offers.' + offer.availability | translate}}</ion-button
|
||||
>
|
||||
<ng-template #availability>
|
||||
<ion-grid *ngIf="offer.availability === 'out of stock'">
|
||||
<ion-row>
|
||||
<ion-col></ion-col>
|
||||
<ion-col width-20 text-right>
|
||||
<ion-text color="danger">
|
||||
<p>{{ 'data.detail.offers.' + offer.availability | translate }}</p>
|
||||
</ion-text>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ng-template>
|
||||
</div>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<h2>{{ price | currency : 'EUR' : 'symbol' : undefined : 'de' }}</h2>
|
||||
</ion-text>
|
||||
<ion-text *ngIf="soldOut" color="danger" class="sold-out" style="white-space: nowrap">
|
||||
<h2>{{ 'data.detail.offers.sold_out' | translate }}</h2>
|
||||
<h2>{{ 'data.detail.offers.out of stock' | translate }}</h2>
|
||||
</ion-text>
|
||||
<p *ngIf="_offers[0].inPlace && !soldOut" class="place" style="white-space: nowrap">
|
||||
<ion-icon name="pin_drop"></ion-icon>{{ _offers[0].inPlace.name }}<span *ngIf="_offers.length > 1"
|
||||
|
||||
@@ -30,20 +30,5 @@
|
||||
<div *ngIf="$any(item).openingHours as openingHours" class="opening-hours">
|
||||
<stapps-opening-hours [openingHours]="openingHours"></stapps-opening-hours>
|
||||
</div>
|
||||
<!-- TODO obviously this is bad style. Tbd where to put the differentiation. Job Postings always have a description, but it's going to be shown in `stapps-job-posting-detail-content` anyways, no need to repeat here. For this view, I would use other fields of the schema.org JobPosting like the `ThingWithCategory.category` -->
|
||||
<div *ngIf="item.description && item.type !== 'job posting'" class="description">
|
||||
<div class="text-accordion" [style.-webkit-line-clamp]="descriptionLinesToDisplay" #accordionTextArea>
|
||||
{{ 'description' | thingTranslate: item }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- TODO see above -->
|
||||
<ion-button
|
||||
expand="full"
|
||||
fill="clear"
|
||||
*ngIf="item.description && item.type !== 'job posting' && buttonShown"
|
||||
(click)="toggleDescriptionAccordion()"
|
||||
>
|
||||
<ion-icon [name]="buttonState" size="large"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
@@ -13,14 +13,6 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.text-accordion {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
ion-card {
|
||||
--background: var(--ion-color-primary);
|
||||
|
||||
@@ -40,10 +32,6 @@ ion-card {
|
||||
ion-card-content {
|
||||
padding: 0 0 var(--header-spacing-bottom);
|
||||
|
||||
.description * {
|
||||
color: var(--ion-color-primary-contrast);
|
||||
}
|
||||
|
||||
.opening-hours {
|
||||
color: var(--ion-color-primary-contrast);
|
||||
}
|
||||
|
||||
@@ -13,81 +13,17 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Component, ElementRef, HostListener, Input, OnChanges, OnInit, ViewChild} from '@angular/core';
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCThings} from '@openstapps/core';
|
||||
import {SCIcon} from '../../../util/ion-icon/icon';
|
||||
|
||||
const AccordionButtonState = {
|
||||
collapsed: SCIcon`expand_more`,
|
||||
expanded: SCIcon`expand_less`,
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-title-card',
|
||||
templateUrl: './title-card.component.html',
|
||||
styleUrls: ['./title-card.component.scss'],
|
||||
})
|
||||
export class TitleCardComponent implements OnInit, OnChanges {
|
||||
export class TitleCardComponent {
|
||||
/**
|
||||
* The item whose title (and description) to display
|
||||
*/
|
||||
@Input() item: SCThings;
|
||||
|
||||
@ViewChild('accordionTextArea') accordionTextArea: ElementRef;
|
||||
|
||||
buttonState = AccordionButtonState.collapsed;
|
||||
|
||||
buttonShown = true;
|
||||
|
||||
descriptionLinesShown: number;
|
||||
|
||||
descriptionLinesTotal: number;
|
||||
|
||||
descriptionPreviewLines = 3;
|
||||
|
||||
descriptionLinesToDisplay = 0;
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.item.description) {
|
||||
this.descriptionLinesToDisplay = this.descriptionPreviewLines;
|
||||
setTimeout(() => this.checkTextElipsis(), 100);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.checkTextElipsis();
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
checkTextElipsis() {
|
||||
if (this.accordionTextArea === undefined) {
|
||||
return;
|
||||
}
|
||||
const element = this.accordionTextArea.nativeElement as HTMLElement;
|
||||
|
||||
const lineHeight = Number.parseInt(getComputedStyle(element).getPropertyValue('line-height'));
|
||||
this.descriptionLinesTotal = element?.scrollHeight / lineHeight;
|
||||
this.descriptionLinesShown = element?.offsetHeight / lineHeight;
|
||||
if (this.buttonState === AccordionButtonState.expanded) {
|
||||
this.descriptionLinesToDisplay = this.descriptionLinesTotal;
|
||||
}
|
||||
const isElipsed = element?.offsetHeight < element?.scrollHeight;
|
||||
this.buttonShown =
|
||||
(isElipsed && this.buttonState === AccordionButtonState.collapsed) ||
|
||||
(!isElipsed && this.buttonState === AccordionButtonState.expanded);
|
||||
}
|
||||
|
||||
toggleDescriptionAccordion() {
|
||||
if (this.descriptionLinesToDisplay > 0) {
|
||||
this.descriptionLinesToDisplay =
|
||||
this.descriptionLinesToDisplay === this.descriptionPreviewLines
|
||||
? this.descriptionLinesTotal
|
||||
: this.descriptionPreviewLines;
|
||||
}
|
||||
this.buttonState =
|
||||
this.buttonState === AccordionButtonState.collapsed
|
||||
? AccordionButtonState.expanded
|
||||
: AccordionButtonState.collapsed;
|
||||
setTimeout(() => this.checkTextElipsis(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const DataListItemIndex: Partial<Record<SCThingType, Type<DataListItem>>> = {
|
||||
[SCThingType.Dish]: DishListItemComponent,
|
||||
[SCThingType.DateSeries]: DateSeriesListItemComponent,
|
||||
[SCThingType.AcademicEvent]: EventListItemComponent,
|
||||
[SCThingType.SportCourse]: DateSeriesListItemComponent,
|
||||
[SCThingType.SportCourse]: EventListItemComponent,
|
||||
[SCThingType.Favorite]: FavoriteListItemComponent,
|
||||
[SCThingType.Message]: MessageListItemComponent,
|
||||
[SCThingType.Organization]: OrganizationListItemComponent,
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
[title]="'performers' | propertyNameTranslate : item | titlecase"
|
||||
[content]="item.performers"
|
||||
></stapps-simple-card>
|
||||
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>
|
||||
<stapps-offers-detail *ngIf="item.offers" [item]="$any(item)"></stapps-offers-detail>
|
||||
<ion-card>
|
||||
<ion-card-header> {{ 'event' | propertyNameTranslate : item | titlecase }} </ion-card-header>
|
||||
<ion-card-content>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<ion-label class="title">{{ 'event.name' | thingTranslate : item }}</ion-label>
|
||||
<p>
|
||||
<ion-icon name="calendar_today"></ion-icon>
|
||||
<span *ngIf="item.dates[0] && item.dates[item.dates.length - 1]">
|
||||
<span *ngIf="item.dates && item.dates[0] && item.dates[item.dates.length - 1]">
|
||||
<span *ngIf="item.repeatFrequency">
|
||||
{{ item.repeatFrequency | durationLocalized : true | sentencecase }}, {{ item.dates[0] |
|
||||
dateFormat : 'weekday:long' }}
|
||||
@@ -30,7 +30,7 @@
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
<ion-note *ngIf="item.event.type === 'academic event'"
|
||||
<ion-note *ngIf="item.event?.type === 'academic event'"
|
||||
>{{ 'categories' | thingTranslate : item.event | join : ', ' }}</ion-note
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
-->
|
||||
|
||||
<stapps-dish-characteristics *ngIf="item.characteristics" [item]="item"></stapps-dish-characteristics>
|
||||
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>
|
||||
<stapps-offers-detail *ngIf="item.offers" [item]="$any(item)"></stapps-offers-detail>
|
||||
<stapps-certifications-in-detail
|
||||
*ngIf="item.certifications"
|
||||
[certifications]="item.certifications"
|
||||
|
||||
@@ -13,7 +13,15 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {SCAcademicEvent, SCSportCourse, SCThing, SCThingTranslator, SCTranslations} from '@openstapps/core';
|
||||
import {
|
||||
SCAcademicEvent,
|
||||
SCDateSeries,
|
||||
SCSportCourse,
|
||||
SCThing,
|
||||
SCThingType,
|
||||
SCTranslations,
|
||||
} from '@openstapps/core';
|
||||
import {DataProvider} from '../../data.provider';
|
||||
|
||||
/**
|
||||
* TODO
|
||||
@@ -24,30 +32,41 @@ import {SCAcademicEvent, SCSportCourse, SCThing, SCThingTranslator, SCTranslatio
|
||||
styleUrls: ['event-detail-content.scss'],
|
||||
})
|
||||
export class EventDetailContentComponent {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Input() item: SCAcademicEvent | SCSportCourse;
|
||||
@Input() set item(value: SCAcademicEvent | SCSportCourse) {
|
||||
this._item = value;
|
||||
this.dateSeries = this.dataProvider
|
||||
.search({
|
||||
filter: {
|
||||
type: 'boolean',
|
||||
arguments: {
|
||||
operation: 'and',
|
||||
filters: [
|
||||
{
|
||||
type: 'value',
|
||||
arguments: {
|
||||
field: 'type',
|
||||
value: SCThingType.DateSeries,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
arguments: {
|
||||
field: 'event.uid',
|
||||
value: value.uid,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(result => result.data as SCDateSeries[]);
|
||||
}
|
||||
|
||||
_item: SCAcademicEvent | SCSportCourse;
|
||||
|
||||
dateSeries: Promise<SCDateSeries[]>;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@Input() language: keyof SCTranslations<SCThing>;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
objectKeys = Object.keys;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
translator: SCThingTranslator;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
constructor() {
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
}
|
||||
constructor(readonly dataProvider: DataProvider) {}
|
||||
}
|
||||
|
||||
@@ -12,39 +12,39 @@
|
||||
~ You should have received a copy of the GNU General Public License along with
|
||||
~ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<p *ngIf="'description' | thingTranslate: _item as description" [innerHtml]="description | sanitizeHtml"></p>
|
||||
|
||||
<stapps-simple-card
|
||||
*ngIf="item.type === 'academic event' && item.categories"
|
||||
[title]="'categories' | propertyNameTranslate : item | titlecase"
|
||||
[content]="'categories' | thingTranslate : item"
|
||||
*ngIf="_item.type === 'academic event' && _item.categories"
|
||||
[title]="'categories' | propertyNameTranslate : _item | titlecase"
|
||||
[content]="'categories' | thingTranslate : _item"
|
||||
>
|
||||
</stapps-simple-card>
|
||||
|
||||
<stapps-add-event-action-chip *ngIf="item.type === 'academic event'" [item]="item">
|
||||
</stapps-add-event-action-chip>
|
||||
<stapps-add-event-action-chip [item]="_item"></stapps-add-event-action-chip>
|
||||
|
||||
<stapps-simple-card
|
||||
*ngIf="item.performers"
|
||||
[title]="'performers' | propertyNameTranslate : item | titlecase"
|
||||
[content]="item.performers"
|
||||
*ngIf="_item.performers"
|
||||
[title]="'performers' | propertyNameTranslate : _item | titlecase"
|
||||
[content]="_item.performers"
|
||||
></stapps-simple-card>
|
||||
<stapps-simple-card
|
||||
*ngIf="item.organizers"
|
||||
[title]="'organizers' | propertyNameTranslate : item | titlecase"
|
||||
[content]="item.organizers"
|
||||
*ngIf="_item.organizers"
|
||||
[title]="'organizers' | propertyNameTranslate : _item | titlecase"
|
||||
[content]="_item.organizers"
|
||||
></stapps-simple-card>
|
||||
<ng-container *ngIf="item.type === 'academic event'">
|
||||
<ng-container *ngIf="_item.type === 'academic event'">
|
||||
<stapps-simple-card
|
||||
*ngIf="item.majors"
|
||||
[title]="'majors' | propertyNameTranslate : item"
|
||||
[content]="item.majors"
|
||||
*ngIf="_item.majors"
|
||||
[title]="'majors' | propertyNameTranslate : _item"
|
||||
[content]="_item.majors"
|
||||
></stapps-simple-card>
|
||||
</ng-container>
|
||||
<ion-card *ngIf="item.catalogs">
|
||||
<ion-card *ngIf="_item.catalogs">
|
||||
<ion-card-header>{{ 'superCatalogs' | propertyNameTranslate : 'catalog' | titlecase }}</ion-card-header>
|
||||
<ion-card-content>
|
||||
<event-route-path
|
||||
*ngFor="let item of item.catalogs"
|
||||
*ngFor="let item of _item.catalogs"
|
||||
[maxItems]="1"
|
||||
[itemsAfterCollapse]="1"
|
||||
[itemsBeforeCollapse]="0"
|
||||
@@ -54,3 +54,4 @@
|
||||
</event-route-path>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
<stapps-simple-data-list [items]="dateSeries"></stapps-simple-data-list>
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
p {
|
||||
margin-inline: var(--spacing-md);
|
||||
}
|
||||
|
||||
stapps-add-event-action-chip {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {DataListItemComponent} from '../../list/data-list-item.component';
|
||||
@Component({
|
||||
selector: 'stapps-event-list-item',
|
||||
templateUrl: 'event-list-item.html',
|
||||
styleUrls: ['event-list-item.scss'],
|
||||
})
|
||||
export class EventListItemComponent extends DataListItemComponent {
|
||||
/**
|
||||
|
||||
@@ -14,27 +14,25 @@
|
||||
-->
|
||||
|
||||
<ion-grid>
|
||||
<ion-row *ngIf="item.type === 'academic event'">
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<div class="ion-text-wrap">
|
||||
<ion-label class="title">{{ 'name' | thingTranslate: item }}</ion-label>
|
||||
<p *ngIf="item.description" class="title-sub">{{ 'description' | thingTranslate: item }}</p>
|
||||
<p
|
||||
*ngIf="'description' | thingTranslate: item as description"
|
||||
class="title-sub"
|
||||
[innerHtml]="description | sanitizeHtml"
|
||||
></p>
|
||||
<p *ngIf="item.academicTerms" class="title-sub">
|
||||
{{ 'name' | thingTranslate: item.academicTerms[0] }}
|
||||
</p>
|
||||
<ion-note *ngIf="!item.categories">{{ 'type' | thingTranslate: item | titlecase }}</ion-note>
|
||||
<ion-note *ngIf="item.categories">
|
||||
{{ 'categories' | thingTranslate: item | join: ', ' | titlecase }}
|
||||
</ion-note>
|
||||
<ng-container *ngIf="item.type === 'academic event'">
|
||||
<ion-note *ngIf="!item.categories">{{ 'type' | thingTranslate: item | titlecase }}</ion-note>
|
||||
<ion-note *ngIf="item.categories">
|
||||
{{ 'categories' | thingTranslate: item | join: ', ' | titlecase }}
|
||||
</ion-note>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row *ngIf="item.type === 'sport course'">
|
||||
<ion-col>
|
||||
<ion-label class="title">{{ 'name' | thingTranslate: item }}</ion-label>
|
||||
<p *ngIf="item.description" class="title-sub">{{ 'description' | thingTranslate: item }}</p>
|
||||
<p *ngIf="item.academicTerms" class="title-sub">{{ 'name' | thingTranslate: item.academicTerms[0] }}</p>
|
||||
<ion-note>{{ 'type' | thingTranslate: item }}</ion-note>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.title-sub {
|
||||
max-height: 2.8rem;
|
||||
overflow: hidden;
|
||||
opacity: 0.8;
|
||||
}
|
||||
@@ -29,4 +29,4 @@
|
||||
[content]="item.datePublished | amDateFormat : 'll'"
|
||||
>
|
||||
</stapps-simple-card>
|
||||
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>
|
||||
<stapps-offers-detail *ngIf="item.offers" [item]="$any(item)"></stapps-offers-detail>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {DataModule} from '../data/data.module';
|
||||
import {TranslateModule} from '@ngx-translate/core';
|
||||
import {SCSearchFilter, SCThingType} from '@openstapps/core';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-sport-course-search-page',
|
||||
templateUrl: 'sport-course-search-page.html',
|
||||
standalone: true,
|
||||
imports: [DataModule, TranslateModule],
|
||||
})
|
||||
export class SportCourseSearchPageComponent {
|
||||
forcedFilter: SCSearchFilter = {
|
||||
type: 'value',
|
||||
arguments: {
|
||||
field: 'type',
|
||||
value: SCThingType.SportCourse,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<stapps-search-page
|
||||
[title]="'sportCourses.title' | translate"
|
||||
[placeholder]="'sportCourses.placeholder' | translate"
|
||||
[showDefaultData]="true"
|
||||
[forcedFilter]="forcedFilter"
|
||||
></stapps-search-page>
|
||||
@@ -0,0 +1,8 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {SportCourseSearchPageComponent} from './sport-course-search-page.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild([{path: 'sport-courses', component: SportCourseSearchPageComponent}])],
|
||||
})
|
||||
export class SportCoursesModule {}
|
||||
@@ -45,7 +45,7 @@ export class ThingTranslateDefaultParser extends ThingTranslateParser {
|
||||
let property = instance as any;
|
||||
|
||||
for (const key of keyPathChain) {
|
||||
property = property[key] ?? undefined;
|
||||
property = property?.[key] ?? undefined;
|
||||
}
|
||||
|
||||
return property;
|
||||
|
||||
15
frontend/app/src/app/util/bypass-trust-url.pipe.ts
Normal file
15
frontend/app/src/app/util/bypass-trust-url.pipe.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {DomSanitizer} from '@angular/platform-browser';
|
||||
|
||||
@Pipe({
|
||||
name: 'bypassSecurityTrustResourceUrl',
|
||||
standalone: true,
|
||||
pure: true,
|
||||
})
|
||||
export class BypassTrustUrlPipe implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
|
||||
transform(url: string) {
|
||||
return this.sanitizer.bypassSecurityTrustUrl(url);
|
||||
}
|
||||
}
|
||||
15
frontend/app/src/app/util/sanitize-html.pipe.ts
Normal file
15
frontend/app/src/app/util/sanitize-html.pipe.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {Pipe, PipeTransform, SecurityContext} from '@angular/core';
|
||||
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
|
||||
|
||||
@Pipe({
|
||||
name: 'sanitizeHtml',
|
||||
standalone: true,
|
||||
pure: true,
|
||||
})
|
||||
export class SanitizeHtmlPipe implements PipeTransform {
|
||||
constructor(private sanitizer: DomSanitizer) {}
|
||||
|
||||
transform(value: string): SafeHtml {
|
||||
return this.sanitizer.sanitize(SecurityContext.HTML, value)!;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,10 @@
|
||||
"employee": "Angestellte",
|
||||
"guest": "Gäste",
|
||||
"student": "Studierende",
|
||||
"sold_out": "Ausverkauft!"
|
||||
"out of stock": "Ausverkauft!",
|
||||
"in stock": "Verfügbar",
|
||||
"limited availability": "Begrenzte Verfügbarkeit",
|
||||
"online only": "Nur online"
|
||||
}
|
||||
},
|
||||
"chips": {
|
||||
@@ -420,6 +423,10 @@
|
||||
"instruction": "Finde alle Informationen rund ums Studium und den Campus",
|
||||
"nothing_found": "Keine Ergebnisse"
|
||||
},
|
||||
"sportCourses": {
|
||||
"title": "Sportkurse",
|
||||
"placeholder": "Sportkurse"
|
||||
},
|
||||
"hebisSearch": {
|
||||
"title": "Bibliothekssuche",
|
||||
"type": "Bibliothek",
|
||||
|
||||
@@ -153,7 +153,10 @@
|
||||
"employee": "Employees",
|
||||
"guest": "Guests",
|
||||
"student": "Students",
|
||||
"sold_out": "Sold Out!"
|
||||
"out of stock": "Sold Out!",
|
||||
"in stock": "Available",
|
||||
"limited": "Limited availability",
|
||||
"online only": "Online only"
|
||||
}
|
||||
},
|
||||
"chips": {
|
||||
@@ -420,6 +423,10 @@
|
||||
"instruction": "Find all information related to your studies and campus",
|
||||
"nothing_found": "No results"
|
||||
},
|
||||
"sportCourses": {
|
||||
"title": "Sport Courses",
|
||||
"placeholder": "Sport courses"
|
||||
},
|
||||
"hebisSearch": {
|
||||
"title": "Library Search",
|
||||
"type": "Library",
|
||||
|
||||
Binary file not shown.
@@ -93,6 +93,28 @@ export const profilePageSections: SCSection[] = [
|
||||
},
|
||||
...SCSectionLinkConstantValues,
|
||||
},
|
||||
{
|
||||
name: 'Sport Courses',
|
||||
icon: SCIcon`sports_gymnastics`,
|
||||
link: ['/sport-courses'],
|
||||
translations: {
|
||||
de: {
|
||||
name: 'Sportkurse',
|
||||
},
|
||||
},
|
||||
...SCSectionLinkConstantValues,
|
||||
},
|
||||
{
|
||||
name: 'Job Postings',
|
||||
icon: SCIcon`work`,
|
||||
link: ['/jobs'],
|
||||
translations: {
|
||||
de: {
|
||||
name: 'Stellenangebote',
|
||||
},
|
||||
},
|
||||
...SCSectionLinkConstantValues,
|
||||
},
|
||||
{
|
||||
name: 'Settings',
|
||||
icon: SCIcon`settings`,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
backend_url: 'https://mobile.server.uni-frankfurt.de',
|
||||
backend_url: 'http://localhost:3000',
|
||||
app_host: 'mobile.app.uni-frankfurt.de',
|
||||
custom_url_scheme: 'de.anyschool.app',
|
||||
backend_version: '4.1.0',
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"declaration": false,
|
||||
"emitDecoratorMetadata": true,
|
||||
"skipLibCheck": false,
|
||||
"isolatedModules": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"resolveJsonModule": true,
|
||||
"downlevelIteration": true,
|
||||
"importHelpers": true,
|
||||
"useDefineForClassFields": false,
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
"dotenv-cli": "7.2.1",
|
||||
"glob": "10.2.7",
|
||||
"junit-report-merger": "6.0.2",
|
||||
"syncpack": "10.5.1",
|
||||
"prettier": "3.1.1",
|
||||
"syncpack": "12.3.0",
|
||||
"turbo": "1.10.16",
|
||||
"turbo-ignore": "1.10.16",
|
||||
"typedoc": "0.24.8",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export class Converter {
|
||||
path: sourcePath,
|
||||
sortProps: true,
|
||||
topRef: false,
|
||||
skipTypeCheck: true,
|
||||
tsconfig: path.join(getTsconfigPath(projectPath), 'tsconfig.json'),
|
||||
type: 'SC',
|
||||
};
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
"compilerOptions": {
|
||||
"noUnusedLocals": false,
|
||||
"stripInternal": true
|
||||
}
|
||||
},
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -76,15 +76,6 @@
|
||||
"typedoc": "0.24.8",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/index.ts"
|
||||
],
|
||||
"sourcemap": true,
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"outDir": "lib"
|
||||
},
|
||||
"prettier": "@openstapps/prettier-config",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export const CORE_VERSION = process.env.CORE_VERSION!;
|
||||
|
||||
export * from './guards.js';
|
||||
export * from './meta.js';
|
||||
export * from './translator.js';
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface SCValueFilterArguments extends SCSearchAbstractFilterArguments
|
||||
|
||||
/**
|
||||
* Value to filter. One or more values has to match the field exactly.
|
||||
*
|
||||
* Leaving the value out will check if the field exists.
|
||||
*/
|
||||
value: string | string[];
|
||||
value?: string | string[];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
13
packages/core/tsup.config.ts
Normal file
13
packages/core/tsup.config.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {defineConfig} from 'tsup';
|
||||
import packageJson from './package.json' assert {type: 'json'};
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
format: 'esm',
|
||||
outDir: 'lib',
|
||||
env: {
|
||||
CORE_VERSION: packageJson.version,
|
||||
},
|
||||
});
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "@openstapps/tsconfig"
|
||||
"extends": "@openstapps/tsconfig",
|
||||
"exclude": ["lib", "app.js"]
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user