Compare commits
No commits in common. "main" and "v1.1.0" have entirely different histories.
5 changed files with 8 additions and 31 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "ff-admin-server",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ff-admin-server",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.0",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ff-admin-server",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.0",
|
||||
"description": "Feuerwehr/Verein Mitgliederverwaltung Server",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -61,13 +61,8 @@ export async function getAllMembers(req: Request, res: Response): Promise<any> {
|
|||
let offset = parseInt((req.query.offset as string) ?? "0");
|
||||
let count = parseInt((req.query.count as string) ?? "25");
|
||||
let search = (req.query.search as string) ?? "";
|
||||
let noLimit = req.query.noLimit === "true";
|
||||
let ids = ((req.query.ids ?? "") as string)
|
||||
.split(",")
|
||||
.filter((i) => i)
|
||||
.map((i) => parseInt(i));
|
||||
|
||||
let [members, total] = await MemberService.getAll({ offset, count, search, noLimit, ids });
|
||||
let [members, total] = await MemberService.getAll(offset, count, search);
|
||||
|
||||
res.json({
|
||||
members: MemberFactory.mapToBase(members),
|
||||
|
|
|
@ -141,7 +141,7 @@ export abstract class NewsletterHelper {
|
|||
}
|
||||
}
|
||||
|
||||
let members = await MemberService.getAll({ noLimit: true });
|
||||
let members = await MemberService.getAll(0, 1000);
|
||||
|
||||
return members[0].filter((m) => queryMemberIds.includes(m.id));
|
||||
}
|
||||
|
|
|
@ -8,19 +8,7 @@ export default abstract class MemberService {
|
|||
* @description get all members
|
||||
* @returns {Promise<[Array<member>, number]>}
|
||||
*/
|
||||
static async getAll({
|
||||
offset = 0,
|
||||
count = 25,
|
||||
search = "",
|
||||
noLimit = false,
|
||||
ids = [],
|
||||
}: {
|
||||
offset?: number;
|
||||
count?: number;
|
||||
search?: string;
|
||||
noLimit?: boolean;
|
||||
ids?: Array<number>;
|
||||
}): Promise<[Array<member>, number]> {
|
||||
static async getAll(offset: number = 0, count: number = 25, search: string = ""): Promise<[Array<member>, number]> {
|
||||
let query = dataSource
|
||||
.getRepository(member)
|
||||
.createQueryBuilder("member")
|
||||
|
@ -66,15 +54,9 @@ export default abstract class MemberService {
|
|||
});
|
||||
}
|
||||
|
||||
if (ids.length != 0) {
|
||||
query = query.where({ id: ids });
|
||||
}
|
||||
|
||||
if (!noLimit) {
|
||||
query = query.offset(offset).limit(count);
|
||||
}
|
||||
|
||||
return await query
|
||||
.offset(offset)
|
||||
.limit(count)
|
||||
.orderBy("member.lastname")
|
||||
.addOrderBy("member.firstname")
|
||||
.addOrderBy("member.nameaffix")
|
||||
|
|
Loading…
Reference in a new issue