finished v1.0

This commit is contained in:
2023-02-24 20:37:52 +01:00
parent 484294e611
commit 4471157412
45 changed files with 638 additions and 350 deletions

View File

@@ -5,6 +5,7 @@ import {Technology} from "../models/technology";
import {Timestamp} from "../models/timestamp";
import {Social} from "../models/social";
import {Message} from "../models/message";
import {About} from "../models/about";
@Injectable({
@@ -14,6 +15,13 @@ export class BackendService {
private pb: PocketBase;
private states: {id: string, name: string}[] = [
{id: 'finished', name: "Fertig"},
{id: 'canceled', name: "Abgebrochen"},
{id: 'paused', name: "Pausiert"},
{id: 'development', name: "In Entwicklung"}
]
constructor() {
this.pb = new PocketBase('https://ed168214-77da-44f1-9a61-859abb49edf8.api.leon-hoppe.de');
}
@@ -23,13 +31,12 @@ export class BackendService {
sort: '-order'
}) as Project[];
const allLanguages = await this.pb?.collection('languages').getFullList();
const states = await this.pb?.collection('project_states').getFullList();
const projects: Project[] = [];
for(let rawProject of rawProjects) {
const project = rawProject as Project;
project.status = states?.filter(state => state.id == rawProject.status)[0]['name'];
project.status = this.states?.filter(state => state.id == rawProject.status)[0]['name'];
if (rawProject.languages != undefined) {
const languages: Language[] = []
@@ -50,7 +57,9 @@ export class BackendService {
}
public async getTimeline(): Promise<Timestamp[]> {
return await this.pb?.collection('timeline').getFullList();
return await this.pb?.collection('timeline').getFullList(200, {
sort: 'date'
});
}
public async getSocials(): Promise<Social[]> {
@@ -61,6 +70,10 @@ export class BackendService {
];
}
public async getAbout(): Promise<About> {
return await this.pb?.collection('about').getFirstListItem('');
}
public async sendMessage(message: Message) {
await this.pb?.collection('messages').create(message);
}