mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add model
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { models } from 'src/plugin/src';
|
||||
const { ArrayField, JsonField} = models.indexedDB.fields;
|
||||
|
||||
export class CalendarEventModel extends models.Model {
|
||||
startTime = models.CharField()
|
||||
endTime = models.CharField()
|
||||
allDay = models.BooleanField()
|
||||
event = JsonField({blank:true})
|
||||
calendarName = models.CharField()
|
||||
profile = models.CharField()
|
||||
id = models.CharField()
|
||||
CalendarId = models.CharField()
|
||||
}
|
||||
|
||||
export class EventForToday extends models.Model {
|
||||
|
||||
}
|
||||
|
||||
|
||||
models.register({
|
||||
databaseName: 'agenda'+environment.version.lastCommitNumber + environment.id,
|
||||
type: 'indexedDB',
|
||||
version: 14,
|
||||
models: [CalendarEventModel, EventForToday]
|
||||
})
|
||||
@@ -61,7 +61,14 @@ export class ActionModel extends models.Model{
|
||||
ActionType = models.CharField()
|
||||
}
|
||||
|
||||
export class PublicationModel extends models.Model{
|
||||
|
||||
export class PublicationFolderModel extends models.Model{
|
||||
DateBegin = models.CharField()
|
||||
Description = models.CharField()
|
||||
Detail = models.CharField()
|
||||
}
|
||||
|
||||
export class PublicationDetailsModel extends models.Model{
|
||||
DateIndex = models.CharField()
|
||||
DocumentId = models.IntegerField({unique: true})
|
||||
ProcessId = models.CharField()
|
||||
@@ -74,12 +81,6 @@ export class PublicationModel extends models.Model{
|
||||
OrganicEntityId = models.IntegerField()
|
||||
}
|
||||
|
||||
models.register({
|
||||
databaseName: 'actions'+environment.version.lastCommitNumber + environment.id,
|
||||
type: 'indexedDB',
|
||||
version: 14,
|
||||
models: [PublicationModel, ActionModel]
|
||||
})
|
||||
|
||||
export class WebtrixUserModel extends models.Model {
|
||||
FullName = models.CharField()
|
||||
@@ -98,5 +99,5 @@ models.register({
|
||||
databaseName: 'actions'+environment.version.lastCommitNumber + environment.id,
|
||||
type: 'indexedDB',
|
||||
version: 14,
|
||||
models: [PublicationModel, ActionModel]
|
||||
models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
|
||||
import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { TaskService } from 'src/app/services/task.service';
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
templateUrl: './events.page.html',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { ModalController, Platform } from '@ionic/angular';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { NewActionPage } from './new-action/new-action.page';
|
||||
@@ -11,12 +11,9 @@ import { Publication } from 'src/app/models/publication';
|
||||
import { ActionsOptionsPage } from 'src/app/shared/popover/actions-options/actions-options.page';
|
||||
import { EditActionPage } from './edit-action/edit-action.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { ActionModel, PublicationModel } from 'src/app/models/beast-orm';
|
||||
import { ActionModel } from 'src/app/models/beast-orm';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -65,11 +62,7 @@ export class PublicationsPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService,
|
||||
private platform: Platform,
|
||||
public ThemeService: ThemeService,
|
||||
private storage: Storage,
|
||||
public p: PermissionService,
|
||||
|
||||
) {
|
||||
@@ -147,17 +140,28 @@ export class PublicationsPage implements OnInit {
|
||||
this.showLoader = false;
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
|
||||
|
||||
|
||||
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
|
||||
this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento')
|
||||
|
||||
ActionModel.create(folders)
|
||||
|
||||
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
|
||||
await this.storage.set('actionsViagens', this.publicationsTravelFolderList);
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
(async ()=> {
|
||||
|
||||
const created = await ActionModel.create(folders)
|
||||
const stored = await ActionModel.all()
|
||||
|
||||
const notPresentOnTheRequest: ActionModel[] = stored.filter(e => {
|
||||
return !folders.find(b => e.ProcessId == b.ProcessId)
|
||||
})
|
||||
|
||||
for (let ActionModelToDelete of notPresentOnTheRequest) {
|
||||
ActionModelToDelete.delete()
|
||||
}
|
||||
|
||||
// console.log({created, stored, folders, toDeletes})
|
||||
|
||||
})()
|
||||
|
||||
|
||||
}, (error) => {
|
||||
this.showLoader = false;
|
||||
this.getFromDB()
|
||||
@@ -165,14 +169,6 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
// addActionToDB(folder) {
|
||||
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
// } else {
|
||||
// this.sqliteservice.addactions(folder);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
getPublicationFolderMap(events: any):PublicationFolder[] {
|
||||
return events.map((data) : PublicationFolder => {
|
||||
return {
|
||||
@@ -186,27 +182,12 @@ export class PublicationsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
this.storage.get('actionsEvents').then((events = []) => {
|
||||
|
||||
if(Array.isArray(events)) {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(events)
|
||||
async getFromDB() {
|
||||
|
||||
const folders: PublicationFolder[] = await ActionModel.all()
|
||||
this.showLoader = false;
|
||||
this.publicationsEventFolderList = folders
|
||||
}
|
||||
|
||||
});
|
||||
this.storage.get('actionsViagens').then((viagens = []) => {
|
||||
|
||||
if(Array.isArray(viagens)) {
|
||||
const folders: PublicationFolder[] = this.getPublicationFolderMap(viagens)
|
||||
|
||||
this.publicationsTravelFolderList = folders
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async editAction(folderId?: string) {
|
||||
|
||||
@@ -15,8 +15,6 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { PublicationModel } from 'src/app/models/beast-orm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
templateUrl: './view-publications.page.html',
|
||||
@@ -44,7 +42,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
private publications: PublicationsService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService,
|
||||
public ThemeService: ThemeService,
|
||||
private toastService: ToastService,
|
||||
|
||||
@@ -10,7 +10,6 @@ import { GetTasksListType } from '../models/GetTasksListType';
|
||||
import { fullTaskList } from '../models/dailyworktask.model';
|
||||
import { ChangeProfileService } from './change-profile.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { StorageService } from './storage.service';
|
||||
import { CPSession } from '../store/documentManagement';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -25,8 +24,7 @@ export class ProcessesService {
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private storageSevice: StorageService
|
||||
private changeProfileService: ChangeProfileService
|
||||
) {
|
||||
|
||||
this.loggeduser = SessionStore.user;
|
||||
|
||||
@@ -12,7 +12,7 @@ import { EditActionPage } from 'src/app/pages/publications/edit-action/edit-acti
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { PublicationModel } from 'src/app/models/beast-orm';
|
||||
import { PublicationDetailsModel } from 'src/app/models/beast-orm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
@@ -107,6 +107,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
getPublicationDetail() {
|
||||
const folderId = this.folderId
|
||||
this.publications.GetPresidentialAction(folderId).subscribe(res=>{
|
||||
|
||||
// PublicationDetailsModel.create(res)
|
||||
this.publicationItem[folderId] = res
|
||||
this.storage.set(folderId+"name", res)
|
||||
}, (error) => {
|
||||
|
||||
@@ -400,7 +400,7 @@ Model.object = ({ queryId, DBconfig, TableSchema, some = null }) => {
|
||||
methods[queryId] = [];
|
||||
const result = await ModelAPIRequest.obj(DBconfig, TableSchema).execute(_methods, queryId);
|
||||
resolve(result);
|
||||
for (let i of result) {
|
||||
for (let i in result) {
|
||||
result[i] = _a.newInstance({ TableSchema, DBconfig, dataToMerge: result[i] });
|
||||
}
|
||||
});
|
||||
@@ -424,7 +424,7 @@ Model.object = ({ queryId, DBconfig, TableSchema, some = null }) => {
|
||||
methods[queryId] = [];
|
||||
const result = await ModelAPIRequest.obj(DBconfig, TableSchema).all(_methods, queryId);
|
||||
resolve(result);
|
||||
for (let i of result) {
|
||||
for (let i in result) {
|
||||
result[i] = _a.newInstance({ TableSchema, DBconfig, dataToMerge: result[i] });
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,12 +1,12 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "8a374730d",
|
||||
"SHA": "8a374730d336317e941df3ebdeaee8823f16e616",
|
||||
"shortSHA": "2fdffbecf",
|
||||
"SHA": "2fdffbecf975e72161646c5a6e94bf2041a81cf5",
|
||||
"branch": "feature/gabinete-search",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Mon Jul 10 14:12:56 2023 +0100'",
|
||||
"lastCommitMessage": "fix decrypt and encript",
|
||||
"lastCommitNumber": "5044",
|
||||
"lastCommitTime": "'Mon Jul 10 15:09:04 2023 +0100'",
|
||||
"lastCommitMessage": "feature/gabinete-search",
|
||||
"lastCommitNumber": "5045",
|
||||
"change": "",
|
||||
"changeStatus": "On branch feature/gabinete-search\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/models/beast-orm-function.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts\n\tmodified: src/app/pipes/custom-task.pipe.ts\n\tmodified: src/app/services/processes.service.ts\n\tmodified: src/app/store/documentManagement.ts",
|
||||
"changeStatus": "On branch feature/gabinete-search\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tnew file: src/app/models/agenda/AgendaModels.ts\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/pages/events/events.page.ts\n\tmodified: src/app/pages/publications/publications.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/services/processes.service.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tmodified: src/plugin/src/models/model.js\n\tmodified: src/plugin/src/tsconfig.tsbuildinfo",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user