Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove back folder #1869

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ethers } from 'ethers'
import fetch from 'isomorphic-fetch'

import { PolygonGasData } from '../../entities/Badges/types'
import { ErrorService } from '../../services/ErrorService'
import { ErrorCategory } from '../../utils/errorCategories'
import { PolygonGasData } from '../entities/Badges/types'
import { ErrorService } from '../services/ErrorService'
import { BlockNativeResponse } from '../types/BlockNative'
import { ErrorCategory } from '../utils/errorCategories'

export class BlockNative {
static async getPolygonGasData(): Promise<PolygonGasData> {
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Badges/storeBadgeSpec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ethers } from 'ethers'
import { NFTStorage } from 'nft.storage'

import { getIpfsAddress } from '../../back/utils/contractInteractions'
import {
NFT_STORAGE_API_KEY,
POLYGON_RAFTS_CONTRACT_ADDRESS,
RAFT_OWNER_PK,
TRIMMED_OTTERSPACE_RAFT_ID,
} from '../../constants'
import { getIpfsAddress } from '../../utils/contractInteractions'
import { toIsoStringDate } from '../../utils/date/toIsoString'
import logger from '../../utils/logger'

Expand Down
6 changes: 3 additions & 3 deletions src/entities/Project/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import isEthereumAddress from 'validator/lib/isEthereumAddress'
import { ZodSchema, z } from 'zod'

import { PersonnelAttributes } from '../../back/models/Personnel'
import { ProjectLink } from '../../back/models/ProjectLink'
import { ProjectMilestone } from '../../back/models/ProjectMilestone'
import { PersonnelAttributes } from '../../models/Personnel'
import { ProjectLink } from '../../models/ProjectLink'
import { ProjectMilestone } from '../../models/ProjectMilestone'

const addressCheck = (data: string) => !data || (!!data && isEthereumAddress(data))

Expand Down
4 changes: 2 additions & 2 deletions src/entities/Proposal/jobs.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { cloneDeep } from 'lodash'

import { DiscordService } from '../../back/services/discord'
import { NotificationService } from '../../back/services/notification'
import { BudgetService } from '../../services/BudgetService'
import { DiscourseService } from '../../services/DiscourseService'
import { DiscordService } from '../../services/discord'
import { NotificationService } from '../../services/notification'
import Time from '../../utils/date/Time'
import logger from '../../utils/logger'
import CoauthorModel from '../Coauthor/model'
Expand Down
4 changes: 2 additions & 2 deletions src/entities/Proposal/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import JobContext from 'decentraland-gatsby/dist/entities/Job/context'
import snakeCase from 'lodash/snakeCase'
import { Pool } from 'pg'

import { DiscordService } from '../../back/services/discord'
import { NotificationService } from '../../back/services/notification'
import { BadgesService } from '../../services/BadgesService'
import BidService from '../../services/BidService'
import { BudgetService } from '../../services/BudgetService'
import { DiscourseService } from '../../services/DiscourseService'
import { ErrorService } from '../../services/ErrorService'
import { ProjectService } from '../../services/ProjectService'
import { ProposalService } from '../../services/ProposalService'
import { DiscordService } from '../../services/discord'
import { NotificationService } from '../../services/notification'
import { ErrorCategory } from '../../utils/errorCategories'
import { isProdEnv } from '../../utils/governanceEnvs'
import logger from '../../utils/logger'
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Proposal/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { toLower } from 'lodash'
import isEthereumAddress from 'validator/lib/isEthereumAddress'
import isUUID from 'validator/lib/isUUID'

import ProjectModel from '../../back/models/Project'
import ProjectModel from '../../models/Project'
import Time from '../../utils/date/Time'
import { UnpublishedBidStatus } from '../Bid/types'
import CoauthorModel from '../Coauthor/model'
Expand Down
4 changes: 2 additions & 2 deletions src/entities/Updates/model.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import crypto from 'crypto'

import { Project } from '../../back/models/Project'
import { UpdateService } from '../../back/services/update'
import * as VestingUtils from '../../clients/VestingData'
import { VestingWithLogs } from '../../clients/VestingData'
import { Project } from '../../models/Project'
import { ProjectService } from '../../services/ProjectService'
import { UpdateService } from '../../services/update'
import Time from '../../utils/date/Time'
import { getMonthsBetweenDates } from '../../utils/date/getMonthsBetweenDates'
import { ProjectStatus } from '../Grant/types'
Expand Down
12 changes: 6 additions & 6 deletions src/back/jobs/BadgeAirdrop.ts → src/jobs/BadgeAirdrop.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ActionStatus } from '../../entities/Badges/types'
import { BadgesService } from '../../services/BadgesService'
import { ErrorService } from '../../services/ErrorService'
import { ErrorCategory } from '../../utils/errorCategories'
import { isProdEnv } from '../../utils/governanceEnvs'
import logger from '../../utils/logger'
import { ActionStatus } from '../entities/Badges/types'
import AirdropJobModel, { AirdropJobAttributes } from '../models/AirdropJob'
import { BadgesService } from '../services/BadgesService'
import { ErrorService } from '../services/ErrorService'
import { AirdropJobStatus } from '../types/AirdropJob'
import { ErrorCategory } from '../utils/errorCategories'
import { isProdEnv } from '../utils/governanceEnvs'
import logger from '../utils/logger'

export async function runQueuedAirdropJobs() {
const pendingJobs = await AirdropJobModel.getPending()
Expand Down
2 changes: 1 addition & 1 deletion src/back/jobs/PingSnapshot.ts → src/jobs/PingSnapshot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SnapshotStatusService } from '../../services/SnapshotStatusService'
import { SnapshotStatusService } from '../services/SnapshotStatusService'

export async function pingSnapshot() {
await SnapshotStatusService.ping()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UpdateModel from '../../entities/Updates/model'
import { DiscourseService } from '../../services/DiscourseService'
import { ProposalService } from '../../services/ProposalService'
import logger from '../../utils/logger'
import UpdateModel from '../entities/Updates/model'
import { DiscourseService } from '../services/DiscourseService'
import { ProposalService } from '../services/ProposalService'
import logger from '../utils/logger'

export async function restoreMissingUpdatesForumPost() {
const affectedUpdates = await UpdateModel.getUpdatesWithoutForumPost()
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/migrations/1692114399675_create-airdrop-jobs-table.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import AirdropJobModel from "../back/models/AirdropJob"
import { AirdropJobStatus } from "../back/types/AirdropJob"
import AirdropJobModel from "../models/AirdropJob"
import { AirdropJobStatus } from "../types/AirdropJob"

export const shorthands: ColumnDefinitions | undefined = undefined

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationBuilder } from 'node-pg-migrate'

import Model from '../back/models/UserNotificationConfig'
import Model from '../models/UserNotificationConfig'

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.createTable(Model.tableName, {
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1702322343224_create-events-table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import EventModel from "../back/models/Event"
import EventModel from "../models/Event"
import { EventType } from "../shared/types/events"

export const shorthands: ColumnDefinitions | undefined = undefined
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1702576442869_create-financials-table.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import Model from "../back/models/Financial"
import Model from "../models/Financial"
import UpdateModel from "../entities/Updates/model"
import { FinancialRecordCateogry } from "../entities/Updates/types"

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1703696214229_financial-optional-link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MigrationBuilder } from "node-pg-migrate"
import Model from "../back/models/Financial"
import Model from "../models/Financial"

export async function up(pgm: MigrationBuilder): Promise<void> {

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1705427899770_events-nullable-address.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import EventModel from "../back/models/Event"
import EventModel from "../models/Event"

export const shorthands: ColumnDefinitions | undefined = undefined

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1706037450493_events-delegation-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import EventModel from "../back/models/Event"
import EventModel from "../models/Event"
import { EventType } from "../shared/types/events"
import { EVENT_TYPE } from "./1702322343224_create-events-table"

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1715012697856_create-projects-table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationBuilder } from 'node-pg-migrate'

import Model from '../back/models/Project'
import Model from '../models/Project'
import { ProjectStatus } from "../entities/Grant/types"
import ProposalModel from "../entities/Proposal/model"

Expand Down
4 changes: 2 additions & 2 deletions src/migrations/1715019261618_create-personnel-table.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MigrationBuilder } from "node-pg-migrate"

import Model from "../back/models/Personnel"
import ProjectModel from "../back/models/Project"
import Model from "../models/Personnel"
import ProjectModel from "../models/Project"

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.createTable(Model.tableName, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationBuilder } from "node-pg-migrate"
import ProjectModel from "../back/models/Project"
import Model, { ProjectMilestoneStatus } from "../back/models/ProjectMilestone"
import ProjectModel from "../models/Project"
import Model, { ProjectMilestoneStatus } from "../models/ProjectMilestone"

const STATUS_TYPE = 'project_milestone_status_type'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder } from "node-pg-migrate"
import Model from "../back/models/ProjectMilestoneUpdate"
import ProjectMilestoneModel from "../back/models/ProjectMilestone"
import Model from "../models/ProjectMilestoneUpdate"
import ProjectMilestoneModel from "../models/ProjectMilestone"

const LEGACY_TABLE_NAME = 'proposal_updates'

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1716383233795_milestone-delivery-date.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ColumnDefinitions, MigrationBuilder } from 'node-pg-migrate'

import Model from '../back/models/ProjectMilestone'
import Model from '../models/ProjectMilestone'

export const shorthands: ColumnDefinitions | undefined = undefined

Expand Down
4 changes: 2 additions & 2 deletions src/migrations/1716924746895_create-project-links-table.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationBuilder } from "node-pg-migrate"
import ProjectModel from "../back/models/Project"
import Model from "../back/models/ProjectLink"
import ProjectModel from "../models/Project"
import Model from "../models/ProjectLink"

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.createTable(Model.tableName, {
Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1716925443361_remove-project-link-column.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { ColumnDefinitions, MigrationBuilder } from "node-pg-migrate"
import Model from "../back/models/Project"
import Model from "../models/Project"

export const shorthands: ColumnDefinitions | undefined = undefined

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MigrationBuilder } from "node-pg-migrate"
import UpdateModel from "../entities/Updates/model"
import ProjectModel from "../back/models/Project"
import ProjectModel from "../models/Project"

export async function up(pgm: MigrationBuilder): Promise<void> {
pgm.addColumn(UpdateModel.tableName, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MigrationBuilder } from "node-pg-migrate"
import ProjectModel from "../back/models/Project"
import ProjectModel from "../models/Project"

const constraintName = 'unique_proposal_id'

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/back/models/Event.ts → src/models/Event.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Model } from 'decentraland-gatsby/dist/entities/Database/model'
import { SQL, conditional, join, table } from 'decentraland-gatsby/dist/entities/Database/utils'

import { Event, EventFilter, EventType } from '../../shared/types/events'
import { Event, EventFilter, EventType } from '../shared/types/events'

const LATEST_EVENTS_LIMIT = 50

Expand Down
10 changes: 5 additions & 5 deletions src/back/models/Financial.ts → src/models/Financial.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Model } from 'decentraland-gatsby/dist/entities/Database/model'
import { SQL, join, table } from 'decentraland-gatsby/dist/entities/Database/utils'

import { NewGrantCategory } from '../../entities/Grant/types'
import ProposalModel from '../../entities/Proposal/model'
import { ProposalAttributes } from '../../entities/Proposal/types'
import UpdateModel from '../../entities/Updates/model'
import { FinancialRecord } from '../../entities/Updates/types'
import { NewGrantCategory } from '../entities/Grant/types'
import ProposalModel from '../entities/Proposal/model'
import { ProposalAttributes } from '../entities/Proposal/types'
import UpdateModel from '../entities/Updates/model'
import { FinancialRecord } from '../entities/Updates/types'

export type FinancialAttributes = {
id: number
Expand Down
2 changes: 1 addition & 1 deletion src/back/models/Personnel.ts → src/models/Personnel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Model } from 'decentraland-gatsby/dist/entities/Database/model'

import { TeamMember } from '../../entities/Grant/types'
import { TeamMember } from '../entities/Grant/types'

export type PersonnelAttributes = TeamMember & {
id: string
Expand Down
10 changes: 5 additions & 5 deletions src/back/models/Project.ts → src/models/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { SQL, table } from 'decentraland-gatsby/dist/entities/Database/utils'
import isEthereumAddress from 'validator/lib/isEthereumAddress'
import isUUID from 'validator/lib/isUUID'

import CoauthorModel from '../../entities/Coauthor/model'
import { CoauthorStatus } from '../../entities/Coauthor/types'
import { ProjectStatus } from '../../entities/Grant/types'
import ProposalModel from '../../entities/Proposal/model'
import { ProjectFunding } from '../../entities/Proposal/types'
import CoauthorModel from '../entities/Coauthor/model'
import { CoauthorStatus } from '../entities/Coauthor/types'
import { ProjectStatus } from '../entities/Grant/types'
import ProposalModel from '../entities/Proposal/model'
import { ProjectFunding } from '../entities/Proposal/types'

import PersonnelModel, { PersonnelAttributes } from './Personnel'
import ProjectLinkModel, { ProjectLink } from './ProjectLink'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/back/routes/badges.ts → src/routes/badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import handleAPI from 'decentraland-gatsby/dist/entities/Route/handle'
import routes from 'decentraland-gatsby/dist/entities/Route/routes'
import { Request } from 'express'

import { storeBadgeSpec } from '../../entities/Badges/storeBadgeSpec'
import { storeBadgeSpec } from '../entities/Badges/storeBadgeSpec'
import {
ActionStatus,
BadgeCreationResult,
GovernanceBadgeSpec,
RevokeOrReinstateResult,
UserBadges,
toOtterspaceRevokeReason,
} from '../../entities/Badges/types'
import { BadgesService } from '../../services/BadgesService'
import CacheService, { TTL_24_HS } from '../../services/CacheService'
} from '../entities/Badges/types'
import { BadgesService } from '../services/BadgesService'
import CacheService, { TTL_24_HS } from '../services/CacheService'
import { AirdropOutcome } from '../types/AirdropJob'
import { createSpec } from '../utils/contractInteractions'
import {
Expand Down
2 changes: 1 addition & 1 deletion src/back/routes/bid.ts → src/routes/bid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import handleAPI from 'decentraland-gatsby/dist/entities/Route/handle'
import routes from 'decentraland-gatsby/dist/entities/Route/routes'
import { Request } from 'express'

import BidService from '../../services/BidService'
import BidService from '../services/BidService'

export default routes((route) => {
route.get('/bids/:tenderId/get-user-bid', auth({ optional: true }), handleAPI(getUserBid))
Expand Down
10 changes: 5 additions & 5 deletions src/back/routes/budget.ts → src/routes/budget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import handleAPI from 'decentraland-gatsby/dist/entities/Route/handle'
import routes from 'decentraland-gatsby/dist/entities/Route/routes'
import { Request } from 'express'

import { TransparencyBudget } from '../../clients/Transparency'
import { Budget, BudgetWithContestants, CategoryBudget } from '../../entities/Budget/types'
import { QuarterBudgetAttributes } from '../../entities/QuarterBudget/types'
import { toNewGrantCategory } from '../../entities/QuarterCategoryBudget/utils'
import { BudgetService } from '../../services/BudgetService'
import { TransparencyBudget } from '../clients/Transparency'
import { Budget, BudgetWithContestants, CategoryBudget } from '../entities/Budget/types'
import { QuarterBudgetAttributes } from '../entities/QuarterBudget/types'
import { toNewGrantCategory } from '../entities/QuarterCategoryBudget/utils'
import { BudgetService } from '../services/BudgetService'
import { validateId } from '../utils/validations'

export default routes((route) => {
Expand Down
12 changes: 6 additions & 6 deletions src/back/routes/coauthor.ts → src/routes/coauthor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import validate from 'decentraland-gatsby/dist/entities/Route/validate'
import schema from 'decentraland-gatsby/dist/entities/Schema'
import { Request } from 'express'

import CoauthorModel from '../../entities/Coauthor/model'
import CoauthorModel from '../entities/Coauthor/model'
import {
CoauthorAttributes,
CoauthorStatus,
UpdateStatus,
toCoauthorStatusType,
updateStatusScheme,
} from '../../entities/Coauthor/types'
import { isCoauthoringUpdatable } from '../../entities/Coauthor/utils'
import ProposalModel from '../../entities/Proposal/model'
import { ProposalAttributes } from '../../entities/Proposal/types'
import logger from '../../utils/logger'
} from '../entities/Coauthor/types'
import { isCoauthoringUpdatable } from '../entities/Coauthor/utils'
import ProposalModel from '../entities/Proposal/model'
import { ProposalAttributes } from '../entities/Proposal/types'
import logger from '../utils/logger'
import { validateAddress } from '../utils/validations'

export default routes((route) => {
Expand Down
2 changes: 1 addition & 1 deletion src/back/routes/committee.ts → src/routes/committee.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import handleAPI from 'decentraland-gatsby/dist/entities/Route/handle'
import routes from 'decentraland-gatsby/dist/entities/Route/routes'

import { COMMITTEE_ADDRESSES } from '../../entities/Committee/isDAOCommittee'
import { COMMITTEE_ADDRESSES } from '../entities/Committee/isDAOCommittee'

export default routes((router) => {
return router.get(
Expand Down
File renamed without changes.
Loading
Loading