Skip to content

Commit

Permalink
Rewrite code to conform to erasableSyntaxOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
junlarsen committed Mar 4, 2025
1 parent b56adb8 commit d007dfe
Show file tree
Hide file tree
Showing 51 changed files with 352 additions and 120 deletions.
22 changes: 11 additions & 11 deletions apps/invoicification/src/app/form-schema.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { z } from "zod"

export enum InvoiceRelation {
COMPANY_PRESENTATION = "Bedriftspresentasjon",
COURSE_EVENT = "Kurs",
OFFLINE_ADVERTISEMENT = "Annonse i Offline",
JOB_LISTING = "Jobbannonse",
EXCURSION_PARTICIPATION = "ITEX",
OTHER = "Annet",
export const InvoiceRelation = {
COMPANY_PRESENTATION: "Bedriftspresentasjon",
COURSE_EVENT: "Kurs",
OFFLINE_ADVERTISEMENT: "Annonse i Offline",
JOB_LISTING: "Jobbannonse",
EXCURSION_PARTICIPATION: "ITEX",
OTHER: "Annet",
}

export enum DeliveryMethod {
EMAIL = "E-post",
POST = "Post",
EHF = "EHF",
export const DeliveryMethod = {
EMAIL: "E-post",
POST: "Post",
EHF: "EHF",
}

export const formSchema = z.object({
Expand Down
4 changes: 3 additions & 1 deletion packages/config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"skipLibCheck": true,
"stripInternal": true,

"noEmit": true
"noEmit": true,

"erasableSyntaxOnly": true
}
}
6 changes: 5 additions & 1 deletion packages/core/src/modules/article/article-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export interface ArticleRepository {
}

export class ArticleRepositoryImpl implements ArticleRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async create(input: ArticleWrite): Promise<Article> {
return await this.db.article.create({ data: input })
Expand Down
16 changes: 12 additions & 4 deletions packages/core/src/modules/article/article-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ export interface ArticleService {
}

export class ArticleServiceImpl implements ArticleService {
private readonly articleRepository: ArticleRepository
private readonly articleTagRepository: ArticleTagRepository
private readonly articleTagLinkRepository: ArticleTagLinkRepository

constructor(
private readonly articleRepository: ArticleRepository,
private readonly articleTagRepository: ArticleTagRepository,
private readonly articleTagLinkRepository: ArticleTagLinkRepository
) {}
articleRepository: ArticleRepository,
articleTagRepository: ArticleTagRepository,
articleTagLinkRepository: ArticleTagLinkRepository
) {
this.articleRepository = articleRepository
this.articleTagRepository = articleTagRepository
this.articleTagLinkRepository = articleTagLinkRepository
}

async create(input: ArticleWrite): Promise<Article> {
return await this.articleRepository.create(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export interface ArticleTagLinkRepository {
}

export class ArticleTagLinkRepositoryImpl implements ArticleTagLinkRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async add(articleId: ArticleId, tagName: ArticleTagName): Promise<void> {
await this.db.articleTagLink.create({ data: { articleId, tagName } })
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/article/article-tag-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export interface ArticleTagRepository {
}

export class ArticleTagRepositoryImpl implements ArticleTagRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getAll(): Promise<ArticleTag[]> {
return await this.db.articleTag.findMany()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export interface AttendancePoolRepository {
}

export class AttendancePoolRepositoryImpl implements AttendancePoolRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async get(id: AttendancePoolId) {
const poolData = await this.db.attendancePool.findUnique({
Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/modules/attendance/attendance-pool-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export interface AttendancePoolService {
}

export class AttendancePoolServiceImpl implements AttendancePoolService {
constructor(
private readonly attendancePoolRepository: AttendancePoolRepository,
private readonly attendeeService: AttendeeService
) {}
private readonly attendancePoolRepository: AttendancePoolRepository
private readonly attendeeService: AttendeeService

constructor(attendancePoolRepository: AttendancePoolRepository, attendeeService: AttendeeService) {
this.attendancePoolRepository = attendancePoolRepository
this.attendeeService = attendeeService
}

async getByAttendanceId(id: AttendanceId) {
return this.attendancePoolRepository.getByAttendanceId(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export interface AttendanceRepository {
}

export class AttendanceRepositoryImpl implements AttendanceRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getAll() {
const attendances = await this.db.attendance.findMany({})
Expand Down
24 changes: 18 additions & 6 deletions packages/core/src/modules/attendance/attendance-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,25 @@ export interface AttendanceService {
}

export class AttendanceServiceImpl implements AttendanceService {
private readonly attendanceRepository: AttendanceRepository
private readonly attendeeRepository: AttendeeRepository
private readonly waitlistAttendeeRepository: WaitlistAttendeRepository
private readonly attendancePoolRepository: AttendancePoolRepository
private readonly userService: UserService

constructor(
private readonly attendanceRepository: AttendanceRepository,
private readonly attendeeRepository: AttendeeRepository,
private readonly waitlistAttendeeRepository: WaitlistAttendeRepository,
private readonly attendancePoolRepository: AttendancePoolRepository,
private readonly userService: UserService
) {}
attendanceRepository: AttendanceRepository,
attendeeRepository: AttendeeRepository,
waitlistAttendeeRepository: WaitlistAttendeRepository,
attendancePoolRepository: AttendancePoolRepository,
userService: UserService
) {
this.attendanceRepository = attendanceRepository
this.attendeeRepository = attendeeRepository
this.waitlistAttendeeRepository = waitlistAttendeeRepository
this.attendancePoolRepository = attendancePoolRepository
this.userService = userService
}

async getExtrasResults(attendanceId: AttendanceId) {
const attendance = await this.attendanceRepository.getById(attendanceId)
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/attendance/attendee-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export interface AttendeeRepository {
}

export class AttendeeRepositoryImpl implements AttendeeRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getByUserId(userId: UserId, attendanceId: AttendanceId) {
const user = await this.db.attendee.findFirst({ where: { userId, attendanceId } })
Expand Down
24 changes: 18 additions & 6 deletions packages/core/src/modules/attendance/attendee-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,25 @@ export interface AttendeeService {
}

export class AttendeeServiceImpl implements AttendeeService {
private readonly attendeeRepository: AttendeeRepository
private readonly attendancePoolRepository: AttendancePoolRepository
private readonly attendanceRespository: AttendanceRepository
private readonly userService: UserService
private readonly waitlistAttendeeService: WaitlistAttendeService

constructor(
private readonly attendeeRepository: AttendeeRepository,
private readonly attendancePoolRepository: AttendancePoolRepository,
private readonly attendanceRespository: AttendanceRepository,
private readonly userService: UserService,
private readonly waitlistAttendeeService: WaitlistAttendeService
) {}
attendeeRepository: AttendeeRepository,
attendancePoolRepository: AttendancePoolRepository,
attendanceRespository: AttendanceRepository,
userService: UserService,
waitlistAttendeeService: WaitlistAttendeService
) {
this.attendeeRepository = attendeeRepository
this.attendancePoolRepository = attendancePoolRepository
this.attendanceRespository = attendanceRespository
this.userService = userService
this.waitlistAttendeeService = waitlistAttendeeService
}

async create(obj: AttendeeWrite) {
return this.attendeeRepository.create(obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export interface WaitlistAttendeRepository {
}

export class WaitlistAttendeRepositoryImpl implements WaitlistAttendeRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async create(data: WaitlistAttendeeWrite): Promise<WaitlistAttendee> {
return await this.db.waitlistAttendee.create({ data })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ export interface WaitlistAttendeService {
}

export class WaitlistAttendeServiceImpl implements WaitlistAttendeService {
private readonly waitlistAttendeeRepository: WaitlistAttendeRepository
private readonly attendancePoolRepository: AttendancePoolRepository

constructor(
private readonly waitlistAttendeeRepository: WaitlistAttendeRepository,
private readonly attendancePoolRepository: AttendancePoolRepository
waitlistAttendeeRepository: WaitlistAttendeRepository,
attendancePoolRepository: AttendancePoolRepository
) {
this.waitlistAttendeeRepository = waitlistAttendeeRepository
this.attendancePoolRepository = attendancePoolRepository
}

async create(obj: WaitlistAttendeeWrite): Promise<WaitlistAttendee> {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/committee/committee-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export interface CommitteeRepository {
}

export class CommitteeRepositoryImpl implements CommitteeRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getById(id: CommitteeId) {
return await this.db.committee.findUnique({ where: { id } })
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/committee/committee-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export interface CommitteeService {
}

export class CommitteeServiceImpl implements CommitteeService {
constructor(private readonly committeeRepository: CommitteeRepository) {}
private readonly committeeRepository: CommitteeRepository

constructor(committeeRepository: CommitteeRepository) {
this.committeeRepository = committeeRepository
}

/**
* Get a committee by its id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ export interface CompanyEventRepository {
}

export class CompanyEventRepositoryImpl implements CompanyEventRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getEventsByCompanyId(companyId: CompanyId) {
return this.db.event.findMany({ where: { companies: { some: { companyId } } } })
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/company/company-event-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export interface CompanyEventService {
}

export class CompanyEventServiceImpl implements CompanyEventService {
constructor(private readonly companyEventRepository: CompanyEventRepository) {}
private readonly companyEventRepository: CompanyEventRepository

constructor(companyEventRepository: CompanyEventRepository) {
this.companyEventRepository = companyEventRepository
}

async getEventsByCompanyId(company: CompanyId): Promise<Event[]> {
return this.companyEventRepository.getEventsByCompanyId(company)
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/company/company-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export interface CompanyRepository {
}

export class CompanyRepositoryImpl implements CompanyRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getById(id: string): Promise<Company | null> {
return await this.db.company.findUnique({ where: { id } })
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/company/company-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export interface CompanyService {
}

export class CompanyServiceImpl implements CompanyService {
constructor(private readonly companyRepository: CompanyRepository) {}
private readonly companyRepository: CompanyRepository

constructor(companyRepository: CompanyRepository) {
this.companyRepository = companyRepository
}

/**
* Get a company by its id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export interface EventCommitteeRepository {
}

export class EventCommitteeRepositoryImpl implements EventCommitteeRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async getAllEventCommittees(eventId: EventId): Promise<Committee[]> {
const eventCommittees = await this.db.eventCommittee.findMany({
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/event/event-committee-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export interface EventCommitteeService {
}

export class EventCommitteeServiceImpl implements EventCommitteeService {
constructor(private readonly committeeOrganizerRepository: EventCommitteeRepository) {}
private readonly committeeOrganizerRepository: EventCommitteeRepository

constructor(committeeOrganizerRepository: EventCommitteeRepository) {
this.committeeOrganizerRepository = committeeOrganizerRepository
}

async getCommitteesForEvent(eventId: EventId): Promise<Committee[]> {
const committees = await this.committeeOrganizerRepository.getAllCommittees(eventId)
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/event/event-company-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export interface EventCompanyRepository {
}

export class EventCompanyRepositoryImpl implements EventCompanyRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async createCompany(eventId: EventId, companyId: CompanyId) {
await this.db.eventCompany.create({ data: { eventId, companyId } })
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/event/event-company-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export interface EventCompanyService {
}

export class EventCompanyServiceImpl implements EventCompanyService {
constructor(private readonly eventCompanyRepository: EventCompanyRepository) {}
private readonly eventCompanyRepository: EventCompanyRepository

constructor(eventCompanyRepository: EventCompanyRepository) {
this.eventCompanyRepository = eventCompanyRepository
}

async createCompany(id: EventId, company: CompanyId) {
const companies = await this.eventCompanyRepository.createCompany(id, company)
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/modules/event/event-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export interface EventRepository {
}

export class EventRepositoryImpl implements EventRepository {
constructor(private readonly db: DBClient) {}
private readonly db: DBClient

constructor(db: DBClient) {
this.db = db
}

async addAttendance(id: EventId, attendanceId: string) {
return await this.db.event.update({ where: { id }, data: { attendanceId } })
Expand Down
Loading

0 comments on commit d007dfe

Please sign in to comment.