Skip to content

Commit

Permalink
Mittwoch 19:30
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Hornburger committed Apr 3, 2024
1 parent ab2089b commit 8e63c7b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/datenstrukturen/mitarbeitersettingsstruktur_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ interface IMitarbeitersettingsstruktur {
LOPListeGeschlossenZeitfilter: number;

AufgabenPersonenfilter: IAufgabenpersonenfilterstruktur[];

FilelisteSpaltenanzahl: number;
};

const Mitarbeitersettingsshema = new mongoose.Schema({
Expand Down Expand Up @@ -119,6 +121,8 @@ const Mitarbeitersettingsshema = new mongoose.Schema({
UrlaubShowMeinenUrlaub: {type: Boolean, default: true},

AufgabenPersonenfilter: {type: [Aufgabenpersonenfiltershema], default: []},

FilelisteSpaltenanzahl: {type: Number, default: 5 },
});

export { Mitarbeitersettingsshema, IMitarbeitersettingsstruktur };
3 changes: 3 additions & 0 deletions src/datenstrukturen/projektpunktestruktur_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ interface IProjektpunktestruktur {
Hauptkostengruppe: number;
Unterkostengruppe: number;

Databasebilderliste: string[];


ZustaendigeExternIDListe: string[];
ZustaendigeInternIDListe: string[];
Expand Down Expand Up @@ -145,6 +147,7 @@ const Projektpunktshema = new mongoose.Schema({
Unterkostengruppe: {type: Number, required: false},
ZustaendigeExternIDListe: [{type: String}],
ZustaendigeInternIDListe: [{type: String}],
Databasebilderliste: [{type: String}],
Ruecklaufreminderliste: [Ruecklaufremindershema],
Bilderliste: [Projektpunktimageshema],
Deleted: {type: Boolean, required: false, default: false},
Expand Down
2 changes: 2 additions & 0 deletions src/datenstrukturen/teamsfilesstruktur_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface ITeamsfilesstruktur {
MediumthumbWebUrl: string;
SmallthumbWebUrl: string;
Beschreibung: string;
Beschreibungcolor: string;
Verfasser: IVerfasserstruktur;
};

Expand All @@ -52,6 +53,7 @@ const Teamsfileshema = new mongoose.Schema({
MediumthumbWebUrl: {type: String, required: false},
SmallthumbWebUrl: {type: String, required: false},
Beschreibung: {type: String, required: false},
Beschreibungcolor: {type: String, required: false},
Verfasser: Verfassershema
});

Expand Down
41 changes: 30 additions & 11 deletions src/routes/thumbnailrouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ export class ThumbnailrouterClass {
let graphClient;
let msalClient;
let tokenRequest;
let Thumbnailname: string;
let SmallThumbnailname: string;
let MediumThumbnailname: string;
let Imagebuffer: ArrayBuffer;
let SmallImagebuffer: Buffer;
let SmallThumbnail: ITeamsfilesstruktur;
let MediumImagebuffer: Buffer;
let MediumThumbnail: ITeamsfilesstruktur;
let SmallUrl: string;
let MediumUrl: string;


this.thumbnailrouter.get('/', this.Authentication.authenticate, (req: Request, res: Response) => {

Expand All @@ -83,7 +92,8 @@ export class ThumbnailrouterClass {
let Url: string = '/sites/' + this.Const.BAESiteID + '/drive/items/' + Teamsfile.id + '/content';
let Werte = Teamsfile.name.split('.');

Thumbnailname = Werte[0] + '_smallthumb.' + Werte[1];
SmallThumbnailname = Werte[0] + '_small.' + Werte[1];
MediumThumbnailname = Werte[0] + '_medium.' + Werte[1];

msalClient = new ConfidentialClientApplication(msalConfig);

Expand Down Expand Up @@ -125,19 +135,28 @@ export class ThumbnailrouterClass {

console.log('getdata ist ok');

Url = '/sites/' + this.Const.BAESiteID + '/drive/items/' + Teamsfile.OnedriveDirectoryID + ':/' + Thumbnailname + ':/content';

try {

let Imagebuffer: ArrayBuffer = await getdata.arrayBuffer();
let SmallImagebuffer: Buffer = await sharp(Imagebuffer).resize(200, 200).toBuffer();
let Thumbnail: ITeamsfilesstruktur = await graphClient.api(Url).put(SmallImagebuffer);
SmallUrl = '/sites/' + this.Const.BAESiteID + '/drive/items/' + Teamsfile.OnedriveDirectoryID + ':/' + SmallThumbnailname + ':/content';

Imagebuffer = await getdata.arrayBuffer();
SmallImagebuffer = await sharp(Imagebuffer).resize(200, 200).toBuffer();
SmallThumbnail = await graphClient.api(SmallUrl).put(SmallImagebuffer);

Teamsfile.SmallthumbFilename = SmallThumbnail.name;
Teamsfile.SmallthumbFileID = SmallThumbnail.id;
Teamsfile.SmallthumbWebUrl = SmallThumbnail.webUrl;

MediumUrl = '/sites/' + this.Const.BAESiteID + '/drive/items/' + Teamsfile.OnedriveDirectoryID + ':/' + MediumThumbnailname + ':/content';

MediumImagebuffer = await sharp(Imagebuffer).resize(800).toBuffer();
MediumThumbnail = await graphClient.api(MediumUrl).put(MediumImagebuffer);

Teamsfile.SmallthumbFilename = Thumbnail.name;
Teamsfile.SmallthumbFileID = Thumbnail.id;
Teamsfile.SmallthumbWebUrl = Thumbnail.webUrl;
Teamsfile.MediumthumbFilename = MediumThumbnail.name;
Teamsfile.MediumthumbFileID = MediumThumbnail.id;
Teamsfile.MediumthumbWebUrl = MediumThumbnail.webUrl;

res.status(200).send({ message: 'Thumbnail wurde erstellt', Teamsfile: Teamsfile });
res.status(200).send({ message: "Thumbnail's wurden erstellt", Teamsfile: Teamsfile });
}
catch (error: any) {

Expand Down

0 comments on commit 8e63c7b

Please sign in to comment.