generated from dreampipcom/nexus
-
-
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.
[DPCP-13] [DPCP-14] ar(feat) 2024 2nd semester rebase. (#3)
* ar(feat) 2024 2nd semester rebase. * ar(feat) 2024 2nd semester rebase. * ar(feat) 2024 2nd semester rebase. * ar(feat) 2024 2nd semester rebase. * ar(feat) 2024 2nd semester rebase. * ar(feat) 2024 2nd semester rebase. * ar(feat) DPCP-13: Valid Schema * ar(feat) DPCP-13: Get seed to work * ar(feat) DPCP-13: Get seed to work * ar(feat) DPCP-13: Get seed to work * ar(feat) DPCP-13: Get seed to work * ar(feat) fix lock * ar(feat) lint * ar(feat) re-add socket * ar(feat) sort it * ar(feat) sort it
- Loading branch information
1 parent
a4f05e0
commit 8078349
Showing
27 changed files
with
3,519 additions
and
1,017 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# .env.local.public | ||
# please copy and fill this to .env.local | ||
# or add it to you ci environment | ||
|
||
|
||
# ---------------- | ||
# PRIVATE VARIABLES | ||
# @@@ WARNING: DON'T ADD NEXT_PUBLIC_* VARIABLES IF THEY'RE PRIVATE @@@ | ||
|
||
# env specific | ||
NEXTAUTH_SECRET=random-string | ||
NEXTAUTH_URL=http://localhost:3001 | ||
MAIN_URL=http://localhost:3000 | ||
|
||
# context specific | ||
GITHUB_ID= | ||
GITHUB_SECRET= | ||
INSTAGRAM_CLIENT_ID= | ||
INSTAGRAM_CLIENT_SECRET= | ||
FACEBOOK_CLIENT_ID= | ||
FACEBOOK_CLIENT_SECRET= | ||
APPLE_CLIENT_ID= | ||
APPLE_CLIENT_SECRET= | ||
|
||
# env agnostic/specific: depends on your setup | ||
EMAIL_SERVER= | ||
EMAIL_FROM= | ||
|
||
# modes: "full" (feats: enable-multi-tenancy,;) | ||
NEXUS_MODE= | ||
|
||
# base path: server-only | ||
NEXUS_BASE_PATH= | ||
|
||
# env agnostic | ||
MONGODB_URI= | ||
|
||
# default db | ||
MONGODB_DATABASE= | ||
|
||
# optional dbs (if used, all must be filled) | ||
MONGODB_USERS_DATABASE= | ||
MONGODB_ORGS_DATABASE= | ||
MONGODB_DEFAULT_ORG= | ||
|
||
# config | ||
ENABLE_LOG=true | ||
LOG_DEPTH=1 |
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 |
---|---|---|
@@ -1,48 +1,6 @@ | ||
# .env.local.public | ||
# please copy and fill this to .env.local | ||
# .env.public | ||
# please copy and fill this to .env | ||
# or add it to you ci environment | ||
|
||
|
||
# ---------------- | ||
# PRIVATE VARIABLES | ||
# @@@ WARNING: DON'T ADD NEXT_PUBLIC_* VARIABLES IF THEY'RE PRIVATE @@@ | ||
|
||
# env specific | ||
NEXTAUTH_SECRET=random-string | ||
NEXTAUTH_URL=http://localhost:3001 | ||
MAIN_URL=http://localhost:3000 | ||
|
||
# context specific | ||
GITHUB_ID= | ||
GITHUB_SECRET= | ||
INSTAGRAM_CLIENT_ID= | ||
INSTAGRAM_CLIENT_SECRET= | ||
FACEBOOK_CLIENT_ID= | ||
FACEBOOK_CLIENT_SECRET= | ||
APPLE_CLIENT_ID= | ||
APPLE_CLIENT_SECRET= | ||
|
||
# env agnostic/specific: depends on your setup | ||
EMAIL_SERVER= | ||
EMAIL_FROM= | ||
|
||
# modes: "full" (feats: enable-multi-tenancy,;) | ||
NEXUS_MODE= | ||
|
||
# base path: server-only | ||
NEXUS_BASE_PATH= | ||
|
||
# env agnostic | ||
MONGODB_URI= | ||
|
||
# default db | ||
MONGODB_DATABASE= | ||
|
||
# optional dbs (if used, all must be filled) | ||
MONGODB_USERS_DATABASE= | ||
MONGODB_ORGS_DATABASE= | ||
MONGODB_DEFAULT_ORG= | ||
|
||
# config | ||
ENABLE_LOG=true | ||
LOG_DEPTH=1 | ||
MONGODB_PRIVATE_URI="" | ||
MONGODB_PUBLIC_URI="" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// @controller/get-public-listings-iface.ts | ||
import { PublicPrisma } from '@model'; | ||
|
||
const PAGE_SIZE = 100; | ||
|
||
const getPublicListings = async ({ page = 0, offset = 0, limit = PAGE_SIZE, filters = [] }: any) => { | ||
const adaptQuery: any = { | ||
skip: page * (limit + offset), | ||
take: limit, | ||
}; | ||
|
||
if (filters?.length) { | ||
try { | ||
const supportedTaxonomies: Record<string, any> = { | ||
modalidade1: { | ||
name: { | ||
es: 'modalidade1', | ||
}, | ||
nature: 'modalidades', | ||
query: { | ||
OR: [ | ||
{ taxonomies: { some: { name: { is: { es: 'Modalidad 1' } } } } }, | ||
{ listingTaxonomies: { some: { name: { is: { es: 'Modalidad 1' } } } } }, | ||
], | ||
}, | ||
}, | ||
especie1: { | ||
name: { | ||
es: 'especie1', | ||
}, | ||
nature: 'especies', | ||
query: { | ||
OR: [ | ||
{ taxonomies: { some: { name: { is: { es: 'Taxonomy Term 1' } } } } }, | ||
{ listingTaxonomies: { some: { name: { is: { es: 'Taxonomy Term 1' } } } } }, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
const query: any = filters?.reduce((acc: any, filter: string) => { | ||
if (!acc.OR) acc.OR = []; | ||
acc.OR.push(supportedTaxonomies[filter].query); | ||
return acc; | ||
}, {}); | ||
|
||
adaptQuery.where = { | ||
...query, | ||
}; | ||
} catch (e) { | ||
throw new Error('Code 001: Wrong filter'); | ||
} | ||
} | ||
|
||
const response = await PublicPrisma.publicListings.findMany(adaptQuery); | ||
|
||
return response; | ||
}; | ||
|
||
export default getPublicListings; |
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,15 @@ | ||
import { PrismaClient as PrivatePrisma } from '@dreampipcom/db-private/prisma-client'; | ||
|
||
const prismaClientSingleton = () => { | ||
return new PrivatePrisma(); | ||
}; | ||
|
||
declare const globalThis: { | ||
prismaPrivateGlobal: ReturnType<typeof prismaClientSingleton>; | ||
} & typeof global; | ||
|
||
const privatePrisma = globalThis.prismaPrivateGlobal ?? prismaClientSingleton(); | ||
|
||
export default privatePrisma; | ||
|
||
if (process.env.NODE_ENV !== 'production') globalThis.prismaPrivateGlobal = privatePrisma; |
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,15 @@ | ||
import { PrismaClient as PublicPrisma } from '@dreampipcom/db-public/prisma-client'; | ||
|
||
const prismaClientSingleton = () => { | ||
return new PublicPrisma(); | ||
}; | ||
|
||
declare const globalThis: { | ||
prismaPublicGlobal: ReturnType<typeof prismaClientSingleton>; | ||
} & typeof global; | ||
|
||
const publicPrisma = globalThis.prismaPublicGlobal ?? prismaClientSingleton(); | ||
|
||
export default publicPrisma; | ||
|
||
if (process.env.NODE_ENV !== 'production') globalThis.prismaPublicGlobal = publicPrisma; |
Oops, something went wrong.