-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Peter Hornburger
committed
Mar 30, 2024
1 parent
cb9a055
commit cef174c
Showing
13 changed files
with
357 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import {Document, DocumentQuery, model, Model} from "mongoose"; | ||
import {DebugClass} from "../debug"; | ||
import {Constclass} from "../constclass"; | ||
import * as mongoose from "mongoose"; | ||
import {Appeinstellungenshema, IAppeinstellungenstruktur} from "../datenstrukturen/appeinstellungenstruktur_server"; | ||
|
||
export class AppeinstellungenDBClass { | ||
|
||
private Debug: DebugClass; | ||
private Const: Constclass; | ||
|
||
constructor() { | ||
|
||
this.Debug = new DebugClass(); | ||
this.Const = new Constclass(); | ||
} | ||
|
||
public ReadAppeinstellungenliste(): Promise<any> { | ||
|
||
try { | ||
|
||
let AppeinstellungenmodalClass: mongoose.Model<mongoose.Document>; | ||
let Liste: IAppeinstellungenstruktur[] = []; | ||
|
||
this.Debug.ShowInfoMessage('ReadAppeinstellungenliste', 'AppeinstellungenDBClass', 'ReadAppeinstellungenliste'); | ||
|
||
return new Promise((resolve, reject) => { | ||
|
||
AppeinstellungenmodalClass = model(this.Const.AppeinstellungencollectionName, Appeinstellungenshema); | ||
|
||
AppeinstellungenmodalClass.find({}).then((data: any) => { | ||
|
||
this.Debug.ShowInfoMessage('Durchsuchen der Appeinstellungenliste wurde ausgeführt. ', 'AppeinstellungenDBClass', 'ReadAppeinstellungenliste'); | ||
|
||
data.forEach((appeinstellung) => { | ||
|
||
Liste.push(appeinstellung._doc); | ||
}); | ||
|
||
this.Debug.ShowInfoMessage(Liste.length + ' Appeinstellungenliste vorhanden.', 'AppeinstellungenDBClass', 'ReadAppeinstellungenliste'); | ||
|
||
resolve(Liste); | ||
|
||
|
||
}).catch((error: any) => { | ||
|
||
this.Debug.ShowErrorMessage('Fehler beim Lesen der Appeinstellungenliste', error, 'AppeinstellungenDBClass', 'ReadAppeinstellungenliste') | ||
|
||
reject(error); | ||
}); | ||
|
||
}); | ||
|
||
} catch (error) { | ||
|
||
this.Debug.ShowErrorMessage(error.message, error, 'AppeinstellungenDBClass', 'ReadAppeinstellungenliste'); | ||
} | ||
} | ||
|
||
public AddAppeinstellungen(data: IAppeinstellungenstruktur):Promise<any> { | ||
|
||
try { | ||
|
||
let Appeinstellungenmodal: mongoose.Document; | ||
|
||
return new Promise<any>((resolve, reject) => { | ||
|
||
delete data._id; | ||
delete data.__v; | ||
|
||
Appeinstellungenmodal = this.GetAppeinstellungenmodal(data); | ||
|
||
Appeinstellungenmodal.save().then((result: Document<any>) => { | ||
|
||
resolve(result); | ||
|
||
}).catch((error) => { | ||
|
||
reject(error); | ||
}); | ||
}); | ||
|
||
} catch (error) { | ||
|
||
this.Debug.ShowErrorMessage(error.message, error, 'AppeinstellungenDBClass', 'AddAppeinstellungen'); | ||
} | ||
} | ||
|
||
public UpdateAppeinstellungen(data: IAppeinstellungenstruktur):Promise<any> { | ||
|
||
try { | ||
|
||
let AppeinstellungenmodalClass: mongoose.Model<mongoose.Document>; | ||
|
||
return new Promise<any>((resolve, reject) => { | ||
|
||
AppeinstellungenmodalClass = model(this.Const.AppeinstellungencollectionName, Appeinstellungenshema); | ||
|
||
AppeinstellungenmodalClass.findById(data._id).then((appeinstellung: mongoose.Document) => { | ||
|
||
if(appeinstellung) { | ||
|
||
appeinstellung.set(data); | ||
appeinstellung.save().then((result: Document) => { | ||
|
||
resolve(result); | ||
|
||
}).catch((error) => { | ||
|
||
reject(error); | ||
}); | ||
} | ||
else { | ||
|
||
resolve(null); | ||
} | ||
}).catch((error) => { | ||
|
||
reject(error); | ||
}); | ||
}); | ||
|
||
} catch (error) { | ||
|
||
this.Debug.ShowErrorMessage(error.message, error, 'AppeinstellungenDBClass', 'UpdateAppeinstellungen'); | ||
} | ||
} | ||
|
||
public GetAppeinstellungenmodal(data: IAppeinstellungenstruktur): mongoose.Document { | ||
|
||
try { | ||
|
||
const AppeinstellungenmodalClass = model(this.Const.AppeinstellungencollectionName, Appeinstellungenshema); | ||
const Appeinstellungenmodal: mongoose.Document = new AppeinstellungenmodalClass(data); | ||
|
||
return Appeinstellungenmodal; | ||
} | ||
catch (error) { | ||
|
||
this.Debug.ShowErrorMessage(error.message, error, 'AppeinstellungenDBClass', 'GetAppeinstellungenmodal'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import mongoose from "mongoose"; | ||
|
||
interface IAbteilungstruktur { | ||
|
||
AbteilungID: string; | ||
Bezeichnung: string; | ||
Kuerzel: string; | ||
}; | ||
|
||
const Abteilungshema = new mongoose.Schema({ | ||
|
||
AbteilungID: {type: String, required: false}, | ||
Bezeichnung: {type: String, required: false}, | ||
Kuerzel: {type: String, required: false}, | ||
|
||
}, {_id: false}); | ||
|
||
export { Abteilungshema, IAbteilungstruktur }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {IJobpossitionstruktur, Jobpossitionshema} from "./jobpossitionstruktur_server"; | ||
import mongoose from "mongoose"; | ||
import {Abteilungshema, IAbteilungstruktur} from "./abteilungstruktur_server"; | ||
import {Gewerkshema, IGewerkstruktur} from "./gewerkstruktur_server"; | ||
|
||
interface IAppeinstellungenstruktur { | ||
|
||
_id: any; | ||
Jobpossitionenliste: IJobpossitionstruktur[]; | ||
Abteilungliste: IAbteilungstruktur[]; | ||
Gewerkeliste: IGewerkstruktur[]; | ||
__v?: any; | ||
} | ||
|
||
const Appeinstellungenshema = new mongoose.Schema({ | ||
|
||
Jobpossitionenliste: [Jobpossitionshema], | ||
Abteilungliste: [Abteilungshema], | ||
Gewerkeliste: [Gewerkshema], | ||
|
||
}); | ||
|
||
export { Appeinstellungenshema, IAppeinstellungenstruktur }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import mongoose from "mongoose"; | ||
|
||
interface IGewerkstruktur { | ||
|
||
GewerkID: string; | ||
Bezeichnung: string; | ||
Kuerzel: string; | ||
}; | ||
|
||
const Gewerkshema = new mongoose.Schema({ | ||
|
||
GewerkID: {type: String, required: false}, | ||
Bezeichnung: {type: String, required: false}, | ||
Kuerzel: {type: String, required: false}, | ||
|
||
}, {_id: false}); | ||
|
||
export { Gewerkshema, IGewerkstruktur }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import mongoose from "mongoose"; | ||
import {Favoritenshema} from "./favoritenstruktur_server"; | ||
import {Meintagshema} from "./meintagstruktur_server"; | ||
import {Meinewocheshema} from "./meinewochestruktur_server"; | ||
import {Urlaubsshema} from "./urlaubsstruktur_server"; | ||
|
||
interface IJobpossitionstruktur { | ||
|
||
JobpossitionID: string; | ||
Bezeichnung: string; | ||
Kuerzel: string; | ||
}; | ||
|
||
const Jobpossitionshema = new mongoose.Schema({ | ||
|
||
JobpossitionID: {type: String, required: false}, | ||
Bezeichnung: {type: String, required: false}, | ||
Kuerzel: {type: String, required: false}, | ||
|
||
}, {_id: false}); | ||
|
||
export { Jobpossitionshema, IJobpossitionstruktur }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.