# Datastruktur
## Noter
* Betaling skal nok trækkes ud af gigs til deres egne dokumenter, for at undgå det findes ud af hvor meget der betales.
## Profiles
### profiles -_the public profiles on the site other users can see_ **/profiles/{UID}**
```typescript
displayName: string
profilePic: string
bio: string // Markdown formatted biography of the user
```
### users -_the private information of users on the site_ **/users/{UID}**
```typescript
birthdate: Timestamp
acceptsGigs?: boolean
laguages: string[] // ISO 639-1 codes for langauges the user understands, in the preffered order.
cprNr: string // Cpr formatted number
nationality: ISO-3166 // Add two letter ISO-3166 code for nationality
skills: Map<string, number> // The ID's of the users skills, and the level they have them at.
adminAccess?: boolean
```
## Skills -_The different types of skills a user can aquire_ **/skills/***
```typescript
title: Map<ISO 639-1, string> // The localized titles of this skill
icons: string
parents?: string[] // If this skill is a subSkill, it'll have parents.
```
## Gig Types
### gigTypes -_the types of gigs that can be created(over og under kategorier)_ **/gigTypes/***
```typescript
title: Map<ISO 639-1, string> // The localized titles of this category
languages: Array<ISO 639-1> // An array of the supported languages, to make querying easier.
img: string // url for the location of the image for this category
visible?: boolean // Is this category visible when creating new gigs
parents?: Map<string, boolean> // The parents for this category, if this is a subType. If not this value must be null, it cannot be undefined.
```
## Companies -_The companies that provide gigs for this platform_ **/companies/***
```typescript
name: string
cvr: string
logo?: string
bio?: string
admins: string[] // The uuids of the Admins of this company, must be at least one
employees: string[] // The uuids of the ordinary employees of this company.
```
## Gigs **/gigs/***
Gigs as a type are special since their shape changes based upon the stage they exist in.
### Stage 0, initial offer (A proposal from the client company):
```typescript
title: string
description?: string
creationDate: TimeStamp
language: ISO 639-1
stage: "initial offer"
requirements?: string[]
client?: string // ID of the company that created the file
email?: string // If an anonymous person created the gig, the email field must be filled out.
files: Array<{fileName: string, fileUrl: string}>
```
### Stage 1, proposal for client (A response to a client offer)
```typescript
title: string
description?: string
creationDate: TimeStamp
modificationDate: TimeStamp
language: ISO 639-1
stage: "proposal for client"
requirements?: string[]
client: string // ID of the company that created the file
files: Array<{fileName: string, fileUrl: string}>
priceOffer: number | {
interval: "yearly",
dayOfPaymentMonth: number
monthOfPayment: number
} | {
interval: "quarterly",
dayOfPaymentMonth: number
monthOfPayment: number // 0-3 the month of the quarter the payment should happen on.
} | {
interval: "monthly",
dayOfPayment: number
}
```
### Stage 2, client rejection (Client rejects the gig)
```typescript
title: string
description?: string
creationDate: TimeStamp
modificationDate: TimeStamp
language: ISO 639-1
stage: "client rejection"
requirements?: string[]
client: string // ID of the company that created the file
files: Array<{fileName: string, fileUrl: string}>
priceOffer: number | {
interval: "yearly",
dayOfPaymentMonth: number
monthOfPayment: number
} | {
interval: "quarterly",
dayOfPaymentMonth: number
monthOfPayment: number // 0-3 the month of the quarter the payment should happen on.
} | {
interval: "monthly",
dayOfPayment: number
}
reason?: string // The client explanation for the rejection
```
### Stage 3, seeking talent (The gig has been accepted, and we now need to find the talent)
```typescript
title: string
description: string
creationDate: TimeStamp
modificationDate: TimeStamp
language: ISO 639-1
stage: "seeking talent"
requirements: string[]
client: string // ID of the company that created the file
files: Array<{fileName: string, fileUrl: string}>
talentSaleryOffers: Array<{
title: string,
salery: number,
period?: "yearly" | "quarterly" | "monthly"
}>
intrestedTalents: string[] // ID's of the interested talents
```
### Stage 4, ongoing (The talent/s have been chosen, and we're now giggin')
```typescript
title: string
description?: string
creationDate: TimeStamp
modificationDate: TimeStamp
language: ISO 639-1
stage: "ongoing"
requirements?: string[]
client: string // ID of the company that created the file
files: Array<{fileName: string, fileUrl: string}>
talents: Map<string, Array[string]> // keys are the job the talents have to do, and then the array is the talents assigned.
```
### Stage 5, achived -_The gig is done, and is saved for analytics_
```typescript
title: string
description?: string
creationDate: TimeStamp
modificationDate: TimeStamp
language: ISO 639-1
stage: "archived"
requirements?: string[]
client: string // ID of the company that created the file
files: Array<{fileName: string, fileUrl: string}>
talents: string[] // ID's of the interested talents
```
## Gig Feedback -_The feedback sent to a user after a gig is completed_ **/gigs/{gig}/feedback/***
```typescript
feedback?: string
quantitative: Map<string, number> // Rating for skills between 0 and 100
recipient: string
```
## Gig corrections -_The corrections a company wants to a gig_ **/gigs/{gig}/corrections/***
### Stage 0, a correction is submitted by a company
```typescript
title?: string
description: string
files: string[],
stage: "proposal"
```
### Stage 1, dojo offers a price on a correction
```typescript
title?: string
description: string
files: string[],
stage: "price proposal"
priceChange: string // A description of how the price will change
```
### Stage 2, rejected
```typescript
title?: string
description: string
files: string[],
stage: "rejected"
priceChange: string // A description of how the price will change
```
### Stage 3, needs to be applied
```typescript
title?: string
description: string
files: string[],
stage: "waiting application"
priceChange: string // A description of how the price will change
```
## Gig payments -_A subcollection to a gig containing all talent payments_ **/gigs/{gig}/payments/***
```typescript
talent: string // The talent that will recive the payment
amount: string
lastPayment?: string // The last payment sent using this doc
expirationDate?: Timestamp // When should automatic payment be stopped
period?: {
interval: "yearly",
dayOfPaymentMonth: number
monthOfPayment: number
} | {
interval: "quarterly",
dayOfPaymentMonth: number
monthOfPayment: number // 0-3 the month of the quarter the payment should happen on.
} | {
interval: "monthly",
dayOfPayment: number
} // If the payment happens more than once, how often and stuff
```
## Gig prices -_How much a company has to pay for a gig_ **/gigPrices/***
```typescript
gig: string // The ID of the gig this price is for
lastInvoice?: string // The last invoice sent using this doc
expirationDate?: Timestamp // When should automatic payment be stopped
price: number | {
interval: "yearly",
dayOfPaymentMonth: number
monthOfPayment: number
} | {
interval: "quarterly",
dayOfPaymentMonth: number
monthOfPayment: number // 0-3 the month of the quarter the payment should happen on.
} | {
interval: "monthly",
dayOfPayment: number
}
```
## Invoices -_The invoices we've sent to economic_ **/invoices/***
```typescript
amount: number
date: TimeStamp
gig: string
sentTo: string // Company ID
```
## Payments -_The payments we've sent to talents_ **/payments/***
```typescript
amount: number
date: TimeStamp
gig: string
sentTo: string // Talent ID
```
## Chats **/gigs/{gig}/chats/***
```typescript
participants: string[] // The people who are a part of this conversation
created: TimeStamp
lastMessage: TimeStamp
```
## Chat messages **/gigs/{gig}/chats/{chat}/messages/***
```typescript
sent: TimeStamp
sender: string
type: "text" | "file"
content: string // Either a link to the file, or the message contents
recivers: string[] // An array of the people who can recive this message
readBy: Map<string, boolean> // Read markers for all who has seen this message
```
## Dojopedia **/dojopedia/***
```typescript
title: string
url: string
language: ISO 639-1
headerImg: string
categories: string[]
```
## Dojopedia submission **/dojopedia/***
```typescript
url: string
```
## Dojopedia categories **/dojopediaCategories/***
```typescript
title: Map<ISO 639-1, string> // The localized titles for this category
icon: string
archived?: boolean
```